diff --git a/README.md b/README.md index 433b69e..4ca5d9f 100644 --- a/README.md +++ b/README.md @@ -1 +1,115 @@ -###POWERREADME### \ No newline at end of file +``` +███████╗██╗ ██╗██████╗ ███████╗██████╗ +██╔════╝██║ ██║██╔══██╗██╔════╝██╔══██╗ +███████╗██║ ██║██████╔╝█████╗ ██████╔╝ +╚════██║██║ ██║██╔═══╝ ██╔══╝ ██╔══██╗ +███████║╚██████╔╝██║ ███████╗██║ ██║ +╚══════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ ███████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗██╔════╝ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝███████╗ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗╚════██║ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║███████║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝╚══════╝ +``` + +### What is JCB Super Powers? +The Joomla Component Builder (JCB) Super Power features are designed to enhance JCB's functionality and streamline the development process. These Super Powers enable developers to efficiently manage and share their custom powers across multiple JCB instances through repositories hosted on [https://git.vdm.dev/[username]/[repository-name]](https://git.vdm.dev). JCB Super Powers are managed using a combination of layers, events, tasks, methods, switches, and algorithms, which work together to provide powerful customization and extensibility options. More details on JCB Super Powers can be found in the [Super Powers Documentation](https://git.vdm.dev/joomla/super-powers/wiki). + +In summary, JCB Super Powers offer a flexible and efficient way to manage and share functionalities between JCB instances. By utilizing a sophisticated system of layers, events, tasks, methods, switches, and algorithms, developers can seamlessly integrate JCB core powers and their custom powers. For more information on how to work with JCB Super Powers, refer to the [Super Powers User Guide](https://git.vdm.dev/joomla/super-powers/wiki). + +### What can I find here? +This repository contains an index (see below) of all the approved powers within the JCB GUI. During the compilation of a component, these powers are automatically added to the repository, ensuring a well-organized and accessible collection of functionalities. + +# Index of powers + +- **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 + - **abstract class BaseConfig** | [Details](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319) | [Code](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.php) | [Settings](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/settings.json) | Super__ffbd4e1f_a342_4080_ab7d_1de3741bf319__Power + - **abstract class BaseTable** | [Details](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6) | [Code](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.php) | [Settings](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/settings.json) | Super__e0f6ddbe_2a35_4537_942c_faff2ebd04f6__Power + - **abstract class Database** | [Details](src/6cbef8f8-4813-48e3-b05a-65e1aea95171) | [Code](src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.php) | [Settings](src/6cbef8f8-4813-48e3-b05a-65e1aea95171/settings.json) | Super__6cbef8f8_4813_48e3_b05a_65e1aea95171__Power + - **abstract class Model** | [Details](src/584747d1-3a86-453d-b7a3-a2219de8d777) | [Code](src/584747d1-3a86-453d-b7a3-a2219de8d777/code.php) | [Settings](src/584747d1-3a86-453d-b7a3-a2219de8d777/settings.json) | Super__584747d1_3a86_453d_b7a3_a2219de8d777__Power + - **abstract class Registry** | [Details](src/7e822c03-1b20-41d1-9427-f5b8d5836af7) | [Code](src/7e822c03-1b20-41d1-9427-f5b8d5836af7/code.php) | [Settings](src/7e822c03-1b20-41d1-9427-f5b8d5836af7/settings.json) | Super__7e822c03_1b20_41d1_9427_f5b8d5836af7__Power +- **Namespace**: [VDM\Joomla\Componentbuilder](#vdm-joomla-componentbuilder) + + - **class Table** | [Details](src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8) | [Code](src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.php) | [Settings](src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/settings.json) | Super__bfd1d6d5_56c1_4fe9_9fee_1c5910e1f5d8__Power +- **Namespace**: [VDM\Joomla\Database](#vdm-joomla-database) + + - **final class Insert** | [Details](src/524eb8f6-38d4-47dc-92ad-98b94e099ac0) | [Code](src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/code.php) | [Settings](src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/settings.json) | Super__524eb8f6_38d4_47dc_92ad_98b94e099ac0__Power + - **final class Load** | [Details](src/06f8eada-d59b-441c-b287-0aea1793da5a) | [Code](src/06f8eada-d59b-441c-b287-0aea1793da5a/code.php) | [Settings](src/06f8eada-d59b-441c-b287-0aea1793da5a/settings.json) | Super__06f8eada_d59b_441c_b287_0aea1793da5a__Power + - **final class Update** | [Details](src/cce56585-58b0-4f72-a92c-e2635ea52d83) | [Code](src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.php) | [Settings](src/cce56585-58b0-4f72-a92c-e2635ea52d83/settings.json) | Super__cce56585_58b0_4f72_a92c_e2635ea52d83__Power +- **Namespace**: [VDM\Joomla\Interfaces](#vdm-joomla-interfaces) + + - **interface Activeregistryinterface** | [Details](src/af0eedbe-603b-4671-8e5a-28165d88254b) | [Code](src/af0eedbe-603b-4671-8e5a-28165d88254b/code.php) | [Settings](src/af0eedbe-603b-4671-8e5a-28165d88254b/settings.json) | Super__af0eedbe_603b_4671_8e5a_28165d88254b__Power + - **interface FactoryInterface** | [Details](src/caf33c5d-858c-4f9a-894f-ab302ec5445a) | [Code](src/caf33c5d-858c-4f9a-894f-ab302ec5445a/code.php) | [Settings](src/caf33c5d-858c-4f9a-894f-ab302ec5445a/settings.json) | Super__caf33c5d_858c_4f9a_894f_ab302ec5445a__Power + - **interface InsertInterface** | [Details](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48) | [Code](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.php) | [Settings](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/settings.json) | Super__ad12ca1c_d3ce_4e7f_88c5_c6c92bdedc48__Power + - **interface LoadInterface** | [Details](src/2ad31f74-f579-499d-b98b-c4f54fd615dd) | [Code](src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.php) | [Settings](src/2ad31f74-f579-499d-b98b-c4f54fd615dd/settings.json) | Super__2ad31f74_f579_499d_b98b_c4f54fd615dd__Power + - **interface ModelInterface** | [Details](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff) | [Code](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.php) | [Settings](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/settings.json) | Super__8aef58c1_3f70_4bd4_b9e4_3f29fcd41cff__Power + - **interface Registryinterface** | [Details](src/64e291c2-11f1-423d-a44d-837cc12cc017) | [Code](src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php) | [Settings](src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json) | Super__64e291c2_11f1_423d_a44d_837cc12cc017__Power + - **interface Tableinterface** | [Details](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf) | [Code](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php) | [Settings](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json) | Super__2da6d6c4_eb29_4d69_8bc2_36d96e916adf__Power + - **interface UpdateInterface** | [Details](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4) | [Code](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php) | [Settings](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json) | Super__7179fde6_1e51_4b51_8545_7ca18f74a0f4__Power +- **Namespace**: [VDM\Joomla\Utilities](#vdm-joomla-utilities) + + - **abstract class ArrayHelper** | [Details](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a) | [Code](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.php) | [Settings](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/settings.json) | Super__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a__Power + - **abstract class Base64Helper** | [Details](src/64a6ff6c-069c-4a11-a76b-db5e36c27690) | [Code](src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.php) | [Settings](src/64a6ff6c-069c-4a11-a76b-db5e36c27690/settings.json) | Super__64a6ff6c_069c_4a11_a76b_db5e36c27690__Power + - **abstract class FileHelper** | [Details](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0) | [Code](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.php) | [Settings](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/settings.json) | Super__a223b31e_ea1d_4cdf_92ae_5f9becffaff0__Power + - **abstract class FormHelper** | [Details](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa) | [Code](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.php) | [Settings](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/settings.json) | Super__1198aecf_84c6_45d2_aea8_d531aa4afdfa__Power + - **abstract class GetHelper** | [Details](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc) | [Code](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.php) | [Settings](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/settings.json) | Super__db87c339_5bb6_4291_a7ef_2c48ea1b06bc__Power + - **abstract class GuidHelper** | [Details](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0) | [Code](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.php) | [Settings](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/settings.json) | Super__9c513baf_b279_43fd_ae29_a585c8cbc4f0__Power + - **abstract class JsonHelper** | [Details](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18) | [Code](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.php) | [Settings](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/settings.json) | Super__4b225c51_d293_48e4_b3f6_5136cf5c3f18__Power + - **abstract class MathHelper** | [Details](src/152c8793-8b75-4715-996a-257b9f65451c) | [Code](src/152c8793-8b75-4715-996a-257b9f65451c/code.php) | [Settings](src/152c8793-8b75-4715-996a-257b9f65451c/settings.json) | Super__152c8793_8b75_4715_996a_257b9f65451c__Power + - **abstract class ObjectHelper** | [Details](src/91004529-94a9-4590-b842-e7c6b624ecf5) | [Code](src/91004529-94a9-4590-b842-e7c6b624ecf5/code.php) | [Settings](src/91004529-94a9-4590-b842-e7c6b624ecf5/settings.json) | Super__91004529_94a9_4590_b842_e7c6b624ecf5__Power + - **abstract class StringHelper** | [Details](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef) | [Code](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.php) | [Settings](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/settings.json) | Super__1f28cb53_60d9_4db1_b517_3c7dc6b429ef__Power +- **Namespace**: [VDM\Joomla\Componentbuilder\Abstraction](#vdm-joomla-componentbuilder-abstraction) + + - **abstract class BaseRegistry** | [Details](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c) | [Code](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.php) | [Settings](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/settings.json) | Super__b84e947d_2a13_44f7_ac0f_3902ae55ae0c__Power +- **Namespace**: [VDM\Joomla\Componentbuilder\Service](#vdm-joomla-componentbuilder-service) + + - **class Database** | [Details](src/4815e1c7-a433-443d-a112-d1e03d7df84b) | [Code](src/4815e1c7-a433-443d-a112-d1e03d7df84b/code.php) | [Settings](src/4815e1c7-a433-443d-a112-d1e03d7df84b/settings.json) | Super__4815e1c7_a433_443d_a112_d1e03d7df84b__Power +- **Namespace**: [VDM\Joomla\Componentbuilder\Utilities](#vdm-joomla-componentbuilder-utilities) + + - **abstract class FilterHelper** | [Details](src/cddcac51-9a46-47c4-ba59-105c70453bd6) | [Code](src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.php) | [Settings](src/cddcac51-9a46-47c4-ba59-105c70453bd6/settings.json) | Super__cddcac51_9a46_47c4_ba59_105c70453bd6__Power +- **Namespace**: [VDM\Joomla\Utilities\Component](#vdm-joomla-utilities-component) + + - **abstract class Helper** | [Details](src/640b5352-fb09-425f-a26e-cd44eda03f15) | [Code](src/640b5352-fb09-425f-a26e-cd44eda03f15/code.php) | [Settings](src/640b5352-fb09-425f-a26e-cd44eda03f15/settings.json) | Super__640b5352_fb09_425f_a26e_cd44eda03f15__Power +- **Namespace**: [VDM\Joomla\Utilities\String](#vdm-joomla-utilities-string) + + - **abstract class ClassfunctionHelper** | [Details](src/30c5b4c2-f75f-4d15-869a-f8bfedd87358) | [Code](src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/code.php) | [Settings](src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/settings.json) | Super__30c5b4c2_f75f_4d15_869a_f8bfedd87358__Power + - **abstract class FieldHelper** | [Details](src/9ef0eb24-aae4-4f5a-99af-d724db44808f) | [Code](src/9ef0eb24-aae4-4f5a-99af-d724db44808f/code.php) | [Settings](src/9ef0eb24-aae4-4f5a-99af-d724db44808f/settings.json) | Super__9ef0eb24_aae4_4f5a_99af_d724db44808f__Power + - **abstract class NamespaceHelper** | [Details](src/ce8cf834-6bac-44fb-941c-861f7e046cc0) | [Code](src/ce8cf834-6bac-44fb-941c-861f7e046cc0/code.php) | [Settings](src/ce8cf834-6bac-44fb-941c-861f7e046cc0/settings.json) | Super__ce8cf834_6bac_44fb_941c_861f7e046cc0__Power + - **abstract class PluginHelper** | [Details](src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6) | [Code](src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/code.php) | [Settings](src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/settings.json) | Super__3cf76fbf_fd95_4a33_878e_7aff6d36b7f6__Power + - **abstract class TypeHelper** | [Details](src/a8935cbe-7701-40dc-bfd5-675f2d600954) | [Code](src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.php) | [Settings](src/a8935cbe-7701-40dc-bfd5-675f2d600954/settings.json) | Super__a8935cbe_7701_40dc_bfd5_675f2d600954__Power +- **Namespace**: [VDM\Joomla\Abstraction\Registry\Traits](#vdm-joomla-abstraction-registry-traits) + + - **trait Count** | [Details](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8) | [Code](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.php) | [Settings](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/settings.json) | Super__11572d9b_e3d5_4b29_904c_9618d8f2bfd8__Power + - **trait GetString** | [Details](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b) | [Code](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.php) | [Settings](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/settings.json) | Super__59b1a2ea_d77e_4040_ac8c_e65cd8743e9b__Power + - **trait InArray** | [Details](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f) | [Code](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.php) | [Settings](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/settings.json) | Super__215b35ac_1b26_4838_bbcf_d1fdbbd9353f__Power + - **trait IsArray** | [Details](src/c09e8968-c767-4175-bb3d-8432f206a2c7) | [Code](src/c09e8968-c767-4175-bb3d-8432f206a2c7/code.php) | [Settings](src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json) | Super__c09e8968_c767_4175_bb3d_8432f206a2c7__Power + - **trait IsString** | [Details](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369) | [Code](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.php) | [Settings](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/settings.json) | Super__ff7d0111_8f79_42aa_ac14_b53ba2c49369__Power + - **trait ToString** | [Details](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e) | [Code](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.php) | [Settings](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/settings.json) | Super__7d494d91_ab60_43cd_aecf_d50e07f7f30e__Power + - **trait VarExport** | [Details](src/52a1d14f-304a-431c-8fa4-411179942db5) | [Code](src/52a1d14f-304a-431c-8fa4-411179942db5/code.php) | [Settings](src/52a1d14f-304a-431c-8fa4-411179942db5/settings.json) | Super__52a1d14f_304a_431c_8fa4_411179942db5__Power + +--- +``` + ██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗ + ██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗ + ██║██║ ██║██║ ██║██╔████╔██║██║ ███████║ +██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║ +╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║ + ╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + ██████╗ ██████╗ ███╗ ███╗██████╗ ██████╗ ███╗ ██╗███████╗███╗ ██╗████████╗ +██╔════╝██╔═══██╗████╗ ████║██╔══██╗██╔═══██╗████╗ ██║██╔════╝████╗ ██║╚══██╔══╝ +██║ ██║ ██║██╔████╔██║██████╔╝██║ ██║██╔██╗ ██║█████╗ ██╔██╗ ██║ ██║ +██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██║██║╚██╗██║██╔══╝ ██║╚██╗██║ ██║ +╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚██████╔╝██║ ╚████║███████╗██║ ╚████║ ██║ + ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═══╝ ╚═╝ +██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗ +██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗ +██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝ +██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗ +██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║ +╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/06f8eada-d59b-441c-b287-0aea1793da5a/README.md b/src/06f8eada-d59b-441c-b287-0aea1793da5a/README.md index 433b69e..c750fbc 100644 --- a/src/06f8eada-d59b-441c-b287-0aea1793da5a/README.md +++ b/src/06f8eada-d59b-441c-b287-0aea1793da5a/README.md @@ -1 +1,167 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Load (Details) +> namespace: **VDM\Joomla\Database** +> extends: **Database** +```uml +@startuml +class Load << (F,LightGreen) >> #RoyalBlue { + + rows(array $select, array $tables, ...) : ?array + + items(array $select, array $tables, ...) : ?array + + row(array $select, array $tables, ...) : ?array + + item(array $select, array $tables, ...) : ?object + + max(string $field, array $tables, ...) : ?int + + count(array $tables, array $filter) : ?int + + value(array $select, array $tables, ...) : mixed + # many(array $select, array $tables, ...) : bool + # one(array $select, array $tables, ...) : bool + # query(array $select, array $tables, ...) : ?object +} + +note right of Load::rows + Load data rows as an array of associated arrays + + since: 3.2.0 + return: ?array + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null + ?int $limit = null +end note + +note left of Load::items + Load data rows as an array of objects + + since: 3.2.0 + return: ?array + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null + ?int $limit = null +end note + +note right of Load::row + Load data row as an associated array + + since: 3.2.0 + return: ?array + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null +end note + +note left of Load::item + Load data row as an object + + since: 3.2.0 + return: ?object + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null +end note + +note right of Load::max + Get the max value based on a filtered result from a given table + + since: 3.2.0 + return: ?int + + arguments: + string $field + array $tables + array $filter +end note + +note left of Load::count + Count the number of items based on filter result from a given table + + since: 3.2.0 + return: ?int +end note + +note right of Load::value + Load one value from a row + + since: 3.2.0 + return: mixed + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null +end note + +note left of Load::many + Load many + + since: 3.2.0 + return: bool + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null + ?int $limit = null +end note + +note right of Load::one + Load one + + since: 3.2.0 + return: bool + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null +end note + +note left of Load::query + Get the query object + + since: 3.2.0 + return: ?object + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null + ?int $limit = null +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/06f8eada-d59b-441c-b287-0aea1793da5a/code.php b/src/06f8eada-d59b-441c-b287-0aea1793da5a/code.php index 26c1a50..620f99c 100644 --- a/src/06f8eada-d59b-441c-b287-0aea1793da5a/code.php +++ b/src/06f8eada-d59b-441c-b287-0aea1793da5a/code.php @@ -9,4 +9,461 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Database; + + +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Interfaces\LoadInterface; +use VDM\Joomla\Abstraction\Database; + + +/** + * Database Load + * + * @since 3.2.0 + */ +final class Load extends Database implements LoadInterface +{ + /** + * Load data rows as an array of associated arrays + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return array|null + * @since 3.2.0 + **/ + public function rows(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): ?array + { + // set key if found + $key = ''; + if (isset($select['key'])) + { + if (is_string($select['key'])) + { + $key = $select['key']; + } + unset($select['key']); + } + + // check if we can get many rows + if ($this->many($select, $tables, $where, $order, $limit)) + { + // return associated arrays from the table records + return $this->db->loadAssocList($key); + } + + // data does not exist + return null; + } + + /** + * Load data rows as an array of objects + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return array|null + * @since 3.2.0 + **/ + public function items(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): ?array + { + // set key if found + $key = ''; + if (isset($select['key'])) + { + if (is_string($select['key'])) + { + $key = $select['key']; + } + unset($select['key']); + } + + // check if we can get many rows + if ($this->many($select, $tables, $where, $order, $limit)) + { + // return associated arrays from the table records + return $this->db->loadObjectList($key); + } + + // data does not exist + return null; + } + + /** + * Load data row as an associated array + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return array|null + * @since 3.2.0 + **/ + public function row(array $select, array $tables, ?array $where = null, ?array $order = null): ?array + { + // check if we can get one row + if ($this->one($select, $tables, $where, $order)) + { + return $this->db->loadAssoc(); + } + + // data does not exist + return null; + } + + /** + * Load data row as an object + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return object|null + * @since 3.2.0 + **/ + public function item(array $select, array $tables, ?array $where = null, ?array $order = null): ?object + { + // check if we can get one row + if ($this->one($select, $tables, $where, $order)) + { + return $this->db->loadObject(); + } + + // data does not exist + return null; + } + + /** + * Get the max value based on a filtered result from a given table + * + * @param string $field The field key + * @param string $tables The tables + * @param array $filter The filter keys + * + * @return int|null + * @since 3.2.0 + **/ + public function max($field, array $tables, array $filter): ?int + { + // only do check if we have the table set + if (isset($tables['a'])) + { + // get the query + $query = $this->query(["all" => "MAX(`$field`)"], $tables, $filter); + + // Load the max number + $this->db->setQuery($query); + $this->db->execute(); + + // check if we have values + if ($this->db->getNumRows()) + { + return (int) $this->db->loadResult(); + } + } + + // data does not exist + return null; + } + + /** + * Count the number of items based on filter result from a given table + * + * @param string $tables The table + * @param array $filter The filter keys + * + * @return int|null + * @since 3.2.0 + **/ + public function count(array $tables, array $filter): ?int + { + // only do check if we have the table set + if (isset($tables['a'])) + { + // get the query + $query = $this->query(["all" => 'COUNT(*)'], $tables, $filter); + + // Load the max number + $this->db->setQuery($query); + $this->db->execute(); + + // check if we have values + if ($this->db->getNumRows()) + { + return (int) $this->db->loadResult(); + } + } + + // data does not exist + return null; + } + + /** + * Load one value from a row + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return mixed + * @since 3.2.0 + **/ + public function value(array $select, array $tables, ?array $where = null, ?array $order = null) + { + // check if we can get one value + if ($this->one($select, $tables, $where, $order)) + { + return $this->db->loadResult(); + } + + // data does not exist + return null; + } + + /** + * Load many + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return bool + * @since 3.2.0 + **/ + protected function many(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): bool + { + // only do check if we have the table set + if (isset($tables['a'])) + { + // get the query + $query = $this->query($select, $tables, $where, $order, $limit); + + // Load the items + $this->db->setQuery($query); + $this->db->execute(); + + // check if we have values + if ($this->db->getNumRows()) + { + return true; + } + } + + // data does not exist + return false; + } + + /** + * Load one + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return bool + * @since 3.2.0 + **/ + protected function one(array $select, array $tables, ?array $where = null, ?array $order = null): bool + { + // only do check if we have the table set + if (isset($tables['a'])) + { + // get the query + $query = $this->query($select, $tables, $where, $order); + + // Load the item + $this->db->setQuery($query, 0, 1); + $this->db->execute(); + + // check if we have values + if ($this->db->getNumRows()) + { + return true; + } + } + + // data does not exist + return false; + } + + /** + * Get the query object + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return object|null The query object (DatabaseQuery) + * @since 3.2.0 + **/ + protected function query(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): ?object + { + $query = $this->db->getQuery(true); + + // check if we have an all selection set + if (isset($select['all'])) + { + // all selection example array: ['all' => ['a.*', 'b.*']] + if (ArrayHelper::check($select['all'])) + { + foreach ($select['all'] as $select_all) + { + // set target selection + $query->select( + $select_all + ); + } + } + // all selection example string: ['all' =>'a.*'] + elseif (is_string($select['all'])) + { + // set target selection + $query->select( + $select['all'] + ); + } + unset($select['all']); + } + + // load the table where join + if (ArrayHelper::check($select)) + { + // set target selection + $query->select( + $this->db->quoteName( + array_keys($select), + array_values($select) + ) + ); + } + + // set main table + $query->from($this->db->quoteName($this->getTable($tables['a']), 'a')); + + // remove main table + unset($tables['a']); + + // load the table where join + if (ArrayHelper::check($tables)) + { + foreach ($tables as $as => $table) + { + $query->join( + 'LEFT', $this->db->quoteName( + $this->getTable($table['name']), $as + ) . ' ON (' . $this->db->quoteName($table['join_on']) + . ' = ' . $this->db->quoteName($table['as_on']) . ')' + ); + } + } + + // load the table where getters + if (ArrayHelper::check($where)) + { + foreach ($where as $key => $value) + { + if (ArrayHelper::check($value)) + { + if (isset($value['value']) && isset($value['operator'])) + { + // check if value needs to be quoted + $quote = $value['quote'] ?? true; + if (!$quote) + { + if (ArrayHelper::check($value['value'])) + { + // add the where by array + $query->where($this->db->quoteName($key) . ' ' . + $value['operator'] . ' (' . + implode(',', $value['value']) + . ')' + ); + } + else + { + // add the where + $query->where($this->db->quoteName($key) . ' ' . + $value['operator'] . ' ' . $value['value']); + } + } + else + { + if (ArrayHelper::check($value['value'])) + { + // add the where by array + $query->where($this->db->quoteName($key) . ' ' . + $value['operator'] . ' (' . + implode(',', + array_map( + fn($val) => $this->quote($val), + $value['value'] + ) + ) + . ')' + ); + } + else + { + // add the where + $query->where($this->db->quoteName($key) . ' ' . + $value['operator'] . ' ' . $this->quote($value['value'])); + } + } + } + else + { + // we should through an exception + // for security we just return nothing for now + return null; + } + } + else + { + // add the where + $query->where($this->db->quoteName($key) . + ' = ' . $this->quote($value)); + } + } + } + + // load the row ordering + if (ArrayHelper::check($order)) + { + foreach ($order as $key => $direction) + { + // add the ordering + $query->order($this->db->quoteName($key) . + ' ' . $direction); + } + } + + // only return a limited number + if (is_numeric($limit)) + { + $query->setLimit($limit); + } + + return $query; + } + +} + diff --git a/src/06f8eada-d59b-441c-b287-0aea1793da5a/code.power b/src/06f8eada-d59b-441c-b287-0aea1793da5a/code.power index 69309b0..a764630 100644 --- a/src/06f8eada-d59b-441c-b287-0aea1793da5a/code.power +++ b/src/06f8eada-d59b-441c-b287-0aea1793da5a/code.power @@ -1 +1,440 @@ -###CODEPOWER### \ No newline at end of file + /** + * Load data rows as an array of associated arrays + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return array|null + * @since 3.2.0 + **/ + public function rows(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): ?array + { + // set key if found + $key = ''; + if (isset($select['key'])) + { + if (is_string($select['key'])) + { + $key = $select['key']; + } + unset($select['key']); + } + + // check if we can get many rows + if ($this->many($select, $tables, $where, $order, $limit)) + { + // return associated arrays from the table records + return $this->db->loadAssocList($key); + } + + // data does not exist + return null; + } + + /** + * Load data rows as an array of objects + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return array|null + * @since 3.2.0 + **/ + public function items(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): ?array + { + // set key if found + $key = ''; + if (isset($select['key'])) + { + if (is_string($select['key'])) + { + $key = $select['key']; + } + unset($select['key']); + } + + // check if we can get many rows + if ($this->many($select, $tables, $where, $order, $limit)) + { + // return associated arrays from the table records + return $this->db->loadObjectList($key); + } + + // data does not exist + return null; + } + + /** + * Load data row as an associated array + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return array|null + * @since 3.2.0 + **/ + public function row(array $select, array $tables, ?array $where = null, ?array $order = null): ?array + { + // check if we can get one row + if ($this->one($select, $tables, $where, $order)) + { + return $this->db->loadAssoc(); + } + + // data does not exist + return null; + } + + /** + * Load data row as an object + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return object|null + * @since 3.2.0 + **/ + public function item(array $select, array $tables, ?array $where = null, ?array $order = null): ?object + { + // check if we can get one row + if ($this->one($select, $tables, $where, $order)) + { + return $this->db->loadObject(); + } + + // data does not exist + return null; + } + + /** + * Get the max value based on a filtered result from a given table + * + * @param string $field The field key + * @param string $tables The tables + * @param array $filter The filter keys + * + * @return int|null + * @since 3.2.0 + **/ + public function max($field, array $tables, array $filter): ?int + { + // only do check if we have the table set + if (isset($tables['a'])) + { + // get the query + $query = $this->query(["all" => "MAX(`$field`)"], $tables, $filter); + + // Load the max number + $this->db->setQuery($query); + $this->db->execute(); + + // check if we have values + if ($this->db->getNumRows()) + { + return (int) $this->db->loadResult(); + } + } + + // data does not exist + return null; + } + + /** + * Count the number of items based on filter result from a given table + * + * @param string $tables The table + * @param array $filter The filter keys + * + * @return int|null + * @since 3.2.0 + **/ + public function count(array $tables, array $filter): ?int + { + // only do check if we have the table set + if (isset($tables['a'])) + { + // get the query + $query = $this->query(["all" => 'COUNT(*)'], $tables, $filter); + + // Load the max number + $this->db->setQuery($query); + $this->db->execute(); + + // check if we have values + if ($this->db->getNumRows()) + { + return (int) $this->db->loadResult(); + } + } + + // data does not exist + return null; + } + + /** + * Load one value from a row + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return mixed + * @since 3.2.0 + **/ + public function value(array $select, array $tables, ?array $where = null, ?array $order = null) + { + // check if we can get one value + if ($this->one($select, $tables, $where, $order)) + { + return $this->db->loadResult(); + } + + // data does not exist + return null; + } + + /** + * Load many + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return bool + * @since 3.2.0 + **/ + protected function many(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): bool + { + // only do check if we have the table set + if (isset($tables['a'])) + { + // get the query + $query = $this->query($select, $tables, $where, $order, $limit); + + // Load the items + $this->db->setQuery($query); + $this->db->execute(); + + // check if we have values + if ($this->db->getNumRows()) + { + return true; + } + } + + // data does not exist + return false; + } + + /** + * Load one + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return bool + * @since 3.2.0 + **/ + protected function one(array $select, array $tables, ?array $where = null, ?array $order = null): bool + { + // only do check if we have the table set + if (isset($tables['a'])) + { + // get the query + $query = $this->query($select, $tables, $where, $order); + + // Load the item + $this->db->setQuery($query, 0, 1); + $this->db->execute(); + + // check if we have values + if ($this->db->getNumRows()) + { + return true; + } + } + + // data does not exist + return false; + } + + /** + * Get the query object + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return object|null The query object (DatabaseQuery) + * @since 3.2.0 + **/ + protected function query(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): ?object + { + $query = $this->db->getQuery(true); + + // check if we have an all selection set + if (isset($select['all'])) + { + // all selection example array: ['all' => ['a.*', 'b.*']] + if (ArrayHelper::check($select['all'])) + { + foreach ($select['all'] as $select_all) + { + // set target selection + $query->select( + $select_all + ); + } + } + // all selection example string: ['all' =>'a.*'] + elseif (is_string($select['all'])) + { + // set target selection + $query->select( + $select['all'] + ); + } + unset($select['all']); + } + + // load the table where join + if (ArrayHelper::check($select)) + { + // set target selection + $query->select( + $this->db->quoteName( + array_keys($select), + array_values($select) + ) + ); + } + + // set main table + $query->from($this->db->quoteName($this->getTable($tables['a']), 'a')); + + // remove main table + unset($tables['a']); + + // load the table where join + if (ArrayHelper::check($tables)) + { + foreach ($tables as $as => $table) + { + $query->join( + 'LEFT', $this->db->quoteName( + $this->getTable($table['name']), $as + ) . ' ON (' . $this->db->quoteName($table['join_on']) + . ' = ' . $this->db->quoteName($table['as_on']) . ')' + ); + } + } + + // load the table where getters + if (ArrayHelper::check($where)) + { + foreach ($where as $key => $value) + { + if (ArrayHelper::check($value)) + { + if (isset($value['value']) && isset($value['operator'])) + { + // check if value needs to be quoted + $quote = $value['quote'] ?? true; + if (!$quote) + { + if (ArrayHelper::check($value['value'])) + { + // add the where by array + $query->where($this->db->quoteName($key) . ' ' . + $value['operator'] . ' (' . + implode(',', $value['value']) + . ')' + ); + } + else + { + // add the where + $query->where($this->db->quoteName($key) . ' ' . + $value['operator'] . ' ' . $value['value']); + } + } + else + { + if (ArrayHelper::check($value['value'])) + { + // add the where by array + $query->where($this->db->quoteName($key) . ' ' . + $value['operator'] . ' (' . + implode(',', + array_map( + fn($val) => $this->quote($val), + $value['value'] + ) + ) + . ')' + ); + } + else + { + // add the where + $query->where($this->db->quoteName($key) . ' ' . + $value['operator'] . ' ' . $this->quote($value['value'])); + } + } + } + else + { + // we should through an exception + // for security we just return nothing for now + return null; + } + } + else + { + // add the where + $query->where($this->db->quoteName($key) . + ' = ' . $this->quote($value)); + } + } + } + + // load the row ordering + if (ArrayHelper::check($order)) + { + foreach ($order as $key => $direction) + { + // add the ordering + $query->order($this->db->quoteName($key) . + ' ' . $direction); + } + } + + // only return a limited number + if (is_numeric($limit)) + { + $query->setLimit($limit); + } + + return $query; + } diff --git a/src/06f8eada-d59b-441c-b287-0aea1793da5a/settings.json b/src/06f8eada-d59b-441c-b287-0aea1793da5a/settings.json index 6b3b222..018772a 100644 --- a/src/06f8eada-d59b-441c-b287-0aea1793da5a/settings.json +++ b/src/06f8eada-d59b-441c-b287-0aea1793da5a/settings.json @@ -1 +1,25 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "6cbef8f8-4813-48e3-b05a-65e1aea95171", + "guid": "06f8eada-d59b-441c-b287-0aea1793da5a", + "implements": [ + "2ad31f74-f579-499d-b98b-c4f54fd615dd" + ], + "load_selection": null, + "name": "Load", + "power_version": "1.0.0", + "system_name": "VDM.Database.Load", + "type": "final class", + "use_selection": { + "use_selection0": { + "use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Database.Load", + "description": "Database Load\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/README.md b/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/README.md index 433b69e..9fa3c2a 100644 --- a/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/README.md +++ b/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/README.md @@ -1 +1,52 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class ArrayHelper (Details) +> namespace: **VDM\Joomla\Utilities** +```uml +@startuml +abstract ArrayHelper #Orange { + + {static} check($array, $removeEmptyString = false) + + {static} merge($arrays) : ?array + + {static} intersect($a_array, $b_array) : bool +} + +note right of ArrayHelper::check + Check if have an array with a length + + since: 3.2.0 +end note + +note right of ArrayHelper::merge + Merge an array of array's + + since: 3.0.9 + return: ?array +end note + +note right of ArrayHelper::intersect + Check if arrays intersect + + since: 3.1.1 + return: bool +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.php b/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.php index b9a864e..70cc939 100644 --- a/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.php +++ b/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.php @@ -9,4 +9,99 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities; + + +/** + * Some array tricks helper + * + * @since 3.0.9 + */ +abstract class ArrayHelper +{ + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns int|false number of items in array on success + * + * @since 3.2.0 + */ + public static function check($array, $removeEmptyString = false) + { + if (is_array($array) && ($nr = count((array) $array)) > 0) + { + // also make sure the empty strings are removed + if ($removeEmptyString) + { + $array = array_filter($array); + + if ($array === []) + { + return false; + } + + return count($array); + } + + return $nr; + } + + return false; + } + + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array|null merged array on success + * + * @since 3.0.9 + */ + public static function merge($arrays): ?array + { + if(self::check($arrays)) + { + $merged = []; + foreach ($arrays as $array) + { + if (self::check($array)) + { + $merged = array_merge($merged, $array); + } + } + return $merged; + } + return null; + } + + /** + * Check if arrays intersect + * + * @input array The first array + * @input array The second array + * + * @returns bool true if intersect else false + * + * @since 3.1.1 + */ + public static function intersect($a_array, $b_array): bool + { + // flip the second array + $b_array = array_flip($b_array); + + // loop the first array + foreach ($a_array as $v) + { + if (isset($b_array[$v])) + { + return true; + } + } + return false; + } + +} + diff --git a/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.power b/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.power index 69309b0..efbf012 100644 --- a/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.power +++ b/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.power @@ -1 +1,83 @@ -###CODEPOWER### \ No newline at end of file + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns int|false number of items in array on success + * + * @since 3.2.0 + */ + public static function check($array, $removeEmptyString = false) + { + if (is_array($array) && ($nr = count((array) $array)) > 0) + { + // also make sure the empty strings are removed + if ($removeEmptyString) + { + $array = array_filter($array); + + if ($array === []) + { + return false; + } + + return count($array); + } + + return $nr; + } + + return false; + } + + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array|null merged array on success + * + * @since 3.0.9 + */ + public static function merge($arrays): ?array + { + if(self::check($arrays)) + { + $merged = []; + foreach ($arrays as $array) + { + if (self::check($array)) + { + $merged = array_merge($merged, $array); + } + } + return $merged; + } + return null; + } + + /** + * Check if arrays intersect + * + * @input array The first array + * @input array The second array + * + * @returns bool true if intersect else false + * + * @since 3.1.1 + */ + public static function intersect($a_array, $b_array): bool + { + // flip the second array + $b_array = array_flip($b_array); + + // loop the first array + foreach ($a_array as $v) + { + if (isset($b_array[$v])) + { + return true; + } + } + return false; + } diff --git a/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/settings.json b/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/settings.json index 6b3b222..7305c7c 100644 --- a/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/settings.json +++ b/src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a", + "implements": null, + "load_selection": null, + "name": "ArrayHelper", + "power_version": "1.0.0", + "system_name": "Utilities Array Helper", + "type": "abstract class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Utilities.ArrayHelper", + "description": "Some array tricks helper\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/README.md b/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/README.md index 433b69e..f99111c 100644 --- a/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/README.md +++ b/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/README.md @@ -1 +1,37 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# trait Count (Details) +> namespace: **VDM\Joomla\Abstraction\Registry\Traits** +```uml +@startuml +class Count << (T,Orange) >> #Turquoise { + + count(string $path) : int +} + +note right of Count::count + Retrieves number of values (or sub-array) from the storage using multiple keys. + + since: 3.2.0 + return: int +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.php b/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.php index 26c1a50..5584a9f 100644 --- a/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.php +++ b/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.php @@ -9,4 +9,43 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction\Registry\Traits; + + +/** + * Count Values + * + * @since 3.2.0 + */ +trait Count +{ + /** + * Retrieves number of values (or sub-array) from the storage using multiple keys. + * + * @param string $path Storage path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return int The number of values + * @since 3.2.0 + */ + public function count(string $path): int + { + if (($values = $this->get($path)) === null) + { + return 0; + } + + if (is_array($values)) + { + return count($values); + } + + if (is_object($values)) + { + return count((array) $values); + } + + return 1; + } +} + diff --git a/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.power b/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.power index 69309b0..9f6ecec 100644 --- a/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.power +++ b/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.power @@ -1 +1,28 @@ -###CODEPOWER### \ No newline at end of file + /** + * Retrieves number of values (or sub-array) from the storage using multiple keys. + * + * @param string $path Storage path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return int The number of values + * @since 3.2.0 + */ + public function count(string $path): int + { + if (($values = $this->get($path)) === null) + { + return 0; + } + + if (is_array($values)) + { + return count($values); + } + + if (is_object($values)) + { + return count((array) $values); + } + + return 1; + } \ No newline at end of file diff --git a/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/settings.json b/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/settings.json index 6b3b222..c873763 100644 --- a/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/settings.json +++ b/src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "11572d9b-e3d5-4b29-904c-9618d8f2bfd8", + "implements": null, + "load_selection": null, + "name": "Count", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.Registry.Traits.Count", + "type": "trait", + "use_selection": null, + "namespace": "VDM\\Joomla\\Abstraction.Registry.Traits.Count", + "description": "Count Values\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/README.md b/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/README.md index 433b69e..b3e1416 100644 --- a/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/README.md +++ b/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/README.md @@ -1 +1,84 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class FormHelper (Details) +> namespace: **VDM\Joomla\Utilities** +```uml +@startuml +abstract FormHelper #Orange { + + {static} xml(array $attributes, ?array $options = null) : ?\SimpleXMLElement + + {static} append(\SimpleXMLElement $xml, mixed $node) : void + + {static} comment(\SimpleXMLElement $xml, string $comment) : void + + {static} attributes(\SimpleXMLElement $xml, array $attributes = []) : void + + {static} options(\SimpleXMLElement $xml, array $options = []) : void + + {static} field(array $attributes, string $default = '', ...) : ?FormField +} + +note right of FormHelper::xml + get the field xml + + since: 3.2.0 + return: ?\SimpleXMLElement +end note + +note right of FormHelper::append + xmlAppend +or a stdClass object containing a comment attribute to be injected +before the XML node and a fieldXML attribute containing a SimpleXMLElement + + since: 3.2.0 + return: void +end note + +note right of FormHelper::comment + xmlComment + + since: 3.2.0 + return: void +end note + +note right of FormHelper::attributes + xmlAddAttributes + + since: 3.2.0 + return: void +end note + +note right of FormHelper::options + xmlAddOptions + + since: 3.2.0 + return: void +end note + +note right of FormHelper::field + get the field object + + since: 3.2.0 + return: ?FormField + + arguments: + array $attributes + string $default = '' + ?array $options = null +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.php b/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.php index 26c1a50..b21d71c 100644 --- a/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.php +++ b/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.php @@ -9,4 +9,179 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Form\FormHelper as JoomlaFormHelper; +use Joomla\CMS\Form\FormField; + + +/** + * Form Helper + * + * @since 3.2.0 + */ +abstract class FormHelper +{ + /** + * get the field xml + * + * @param array $attributes The array of attributes + * @param array $options The options to apply to the XML element + * + * @return \SimpleXMLElement|null + * @since 3.2.0 + */ + public static function xml(array $attributes, ?array $options = null): ?\SimpleXMLElement + { + // make sure we have attributes and a type value + if (ArrayHelper::check($attributes)) + { + // start field xml + $XML = new \SimpleXMLElement(''); + + // load the attributes + self::attributes($XML, $attributes); + + // check if we have options + if (ArrayHelper::check($options)) + { + // load the options + self::options($XML, $options); + } + + // return the field xml + return $XML; + } + + return null; + } + + /** + * xmlAppend + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param mixed $node A SimpleXMLElement node to append to the XML element reference, + * or a stdClass object containing a comment attribute to be injected + * before the XML node and a fieldXML attribute containing a SimpleXMLElement + * + * @return void + * @since 3.2.0 + */ + public static function append(\SimpleXMLElement &$xml, $node) + { + if (!$node) + { + // element was not returned + return; + } + + if ($node instanceof \stdClass) + { + if (property_exists($node, 'comment')) + { + self::comment($xml, $node->comment); + } + if (property_exists($node, 'fieldXML')) + { + self::append($xml, $node->fieldXML); + } + } + elseif ($node instanceof \SimpleXMLElement) + { + $domXML = \dom_import_simplexml($xml); + $domNode = \dom_import_simplexml($node); + $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); + $xml = \simplexml_import_dom($domXML); + } + } + + /** + * xmlComment + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param string $comment The comment to inject + * + * @return void + * @since 3.2.0 + */ + public static function comment(\SimpleXMLElement &$xml, string $comment) + { + $domXML = \dom_import_simplexml($xml); + $domComment = new \DOMComment($comment); + $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); + $domXML->appendChild($nodeTarget); + $xml = \simplexml_import_dom($domXML); + } + + /** + * xmlAddAttributes + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $attributes The attributes to apply to the XML element + * + * @return void + * @since 3.2.0 + */ + public static function attributes(\SimpleXMLElement &$xml, array $attributes = []) + { + foreach ($attributes as $key => $value) + { + $xml->addAttribute($key, $value ?? ''); + } + } + + /** + * xmlAddOptions + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $options The options to apply to the XML element + * + * @return void + * @since 3.2.0 + */ + public static function options(\SimpleXMLElement &$xml, array $options = []) + { + foreach ($options as $key => $value) + { + $addOption = $xml->addChild('option'); + $addOption->addAttribute('value', $key ?? ''); + $addOption[] = $value; + } + } + + /** + * get the field object + * + * @param array $attributes The array of attributes + * @param string $default The default of the field + * @param array $options The options to apply to the XML element + * + * @return FormField|null + * @since 3.2.0 + */ + public static function field(array $attributes, string $default = '', ?array $options = null): ?FormField + { + // make sure we have attributes and a type value + if (ArrayHelper::check($attributes) && isset($attributes['type'])) + { + // get field type + if (($field = JoomlaFormHelper::loadFieldType($attributes['type'], true)) === false) + { + return null; + } + + // get field xml + $XML = self::xml($attributes, $options); + + // setup the field + $field->setup($XML, $default); + + // return the field object + return $field; + } + + return null; + } +} + diff --git a/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.power b/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.power index 69309b0..51511e4 100644 --- a/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.power +++ b/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.power @@ -1 +1,160 @@ -###CODEPOWER### \ No newline at end of file + /** + * get the field xml + * + * @param array $attributes The array of attributes + * @param array $options The options to apply to the XML element + * + * @return \SimpleXMLElement|null + * @since 3.2.0 + */ + public static function xml(array $attributes, ?array $options = null): ?\SimpleXMLElement + { + // make sure we have attributes and a type value + if (ArrayHelper::check($attributes)) + { + // start field xml + $XML = new \SimpleXMLElement(''); + + // load the attributes + self::attributes($XML, $attributes); + + // check if we have options + if (ArrayHelper::check($options)) + { + // load the options + self::options($XML, $options); + } + + // return the field xml + return $XML; + } + + return null; + } + + /** + * xmlAppend + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param mixed $node A SimpleXMLElement node to append to the XML element reference, + * or a stdClass object containing a comment attribute to be injected + * before the XML node and a fieldXML attribute containing a SimpleXMLElement + * + * @return void + * @since 3.2.0 + */ + public static function append(\SimpleXMLElement &$xml, $node) + { + if (!$node) + { + // element was not returned + return; + } + + if ($node instanceof \stdClass) + { + if (property_exists($node, 'comment')) + { + self::comment($xml, $node->comment); + } + if (property_exists($node, 'fieldXML')) + { + self::append($xml, $node->fieldXML); + } + } + elseif ($node instanceof \SimpleXMLElement) + { + $domXML = \dom_import_simplexml($xml); + $domNode = \dom_import_simplexml($node); + $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); + $xml = \simplexml_import_dom($domXML); + } + } + + /** + * xmlComment + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param string $comment The comment to inject + * + * @return void + * @since 3.2.0 + */ + public static function comment(\SimpleXMLElement &$xml, string $comment) + { + $domXML = \dom_import_simplexml($xml); + $domComment = new \DOMComment($comment); + $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); + $domXML->appendChild($nodeTarget); + $xml = \simplexml_import_dom($domXML); + } + + /** + * xmlAddAttributes + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $attributes The attributes to apply to the XML element + * + * @return void + * @since 3.2.0 + */ + public static function attributes(\SimpleXMLElement &$xml, array $attributes = []) + { + foreach ($attributes as $key => $value) + { + $xml->addAttribute($key, $value ?? ''); + } + } + + /** + * xmlAddOptions + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $options The options to apply to the XML element + * + * @return void + * @since 3.2.0 + */ + public static function options(\SimpleXMLElement &$xml, array $options = []) + { + foreach ($options as $key => $value) + { + $addOption = $xml->addChild('option'); + $addOption->addAttribute('value', $key ?? ''); + $addOption[] = $value; + } + } + + /** + * get the field object + * + * @param array $attributes The array of attributes + * @param string $default The default of the field + * @param array $options The options to apply to the XML element + * + * @return FormField|null + * @since 3.2.0 + */ + public static function field(array $attributes, string $default = '', ?array $options = null): ?FormField + { + // make sure we have attributes and a type value + if (ArrayHelper::check($attributes) && isset($attributes['type'])) + { + // get field type + if (($field = JoomlaFormHelper::loadFieldType($attributes['type'], true)) === false) + { + return null; + } + + // get field xml + $XML = self::xml($attributes, $options); + + // setup the field + $field->setup($XML, $default); + + // return the field object + return $field; + } + + return null; + } \ No newline at end of file diff --git a/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/settings.json b/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/settings.json index 6b3b222..3380659 100644 --- a/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/settings.json +++ b/src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/settings.json @@ -1 +1,22 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "0", + "guid": "1198aecf-84c6-45d2-aea8-d531aa4afdfa", + "implements": null, + "load_selection": { + "load_selection0": { + "load": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a" + } + }, + "name": "FormHelper", + "power_version": "1.0.0", + "system_name": "Utilities FormHelper", + "type": "abstract class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Utilities.FormHelper", + "description": "Form Helper\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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\\CMS\\Form\\FormHelper as JoomlaFormHelper;\r\nuse Joomla\\CMS\\Form\\FormField;", + "composer": "" +} \ No newline at end of file diff --git a/src/152c8793-8b75-4715-996a-257b9f65451c/README.md b/src/152c8793-8b75-4715-996a-257b9f65451c/README.md index 433b69e..03cc3e1 100644 --- a/src/152c8793-8b75-4715-996a-257b9f65451c/README.md +++ b/src/152c8793-8b75-4715-996a-257b9f65451c/README.md @@ -1 +1,51 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class MathHelper (Details) +> namespace: **VDM\Joomla\Utilities** +```uml +@startuml +abstract MathHelper #Orange { + + {static} bc(string $type, int $val1, ...) : string|int|null|bool + + {static} sum(array $array, int $scale = 4) : float +} + +note right of MathHelper::bc + bc math wrapper (very basic not for accounting) + + since: 3.0.9 + return: string|int|null|bool + + arguments: + string $type + int $val1 + int $val2 + int $scale +end note + +note right of MathHelper::sum + Basic sum of an array with more precision + + since: 3.0.9 + return: float +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/152c8793-8b75-4715-996a-257b9f65451c/code.php b/src/152c8793-8b75-4715-996a-257b9f65451c/code.php index b9a864e..e407440 100644 --- a/src/152c8793-8b75-4715-996a-257b9f65451c/code.php +++ b/src/152c8793-8b75-4715-996a-257b9f65451c/code.php @@ -9,4 +9,94 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities; + + +/** + * Basic Math Helper + * + * @since 3.0.9 + */ +abstract class MathHelper +{ + /** + * 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 string|int|null|bool + * + * @since 3.0.9 + */ + public static function bc($type, $val1, $val2, $scale = 0) + { + // Validate input + if (!is_numeric($val1) || !is_numeric($val2)) + { + return null; + } + + // Build function name + $function = 'bc' . $type; + + // Use the bcmath function if available + if (is_callable($function)) + { + return $function($val1, $val2, $scale); + } + + // if function does not exist we use +-*/ operators (fallback - not ideal) + switch ($type) + { + case 'mul': + return (string) round($val1 * $val2, $scale); + case 'div': + if ($val2 == 0) return null; // Avoid division by zero + return (string) round($val1 / $val2, $scale); + case 'add': + return (string) round($val1 + $val2, $scale); + case 'sub': + return (string) round($val1 - $val2, $scale); + case 'pow': + return (string) round(pow($val1, $val2), $scale); + case 'comp': + $diff = round($val1 - $val2, $scale); + return ($diff > 0) ? 1 : (($diff < 0) ? -1 : 0); + } + + return null; + } + + /** + * Basic sum of an array with more precision + * + * @param array $array The values to sum + * @param int $scale The scale value + * + * @return float + * + * @since 3.0.9 + */ + public static function sum($array, $scale = 4) + { + // use the bcadd function if available + if (function_exists('bcadd')) + { + // set the start value + $value = 0.0; + // loop the values and run bcadd + foreach($array as $val) + { + $value = bcadd($value, (string) $val, $scale); + } + return $value; + } + // fall back on array sum + return array_sum($array); + } + +} + diff --git a/src/152c8793-8b75-4715-996a-257b9f65451c/code.power b/src/152c8793-8b75-4715-996a-257b9f65451c/code.power index 69309b0..b4a2034 100644 --- a/src/152c8793-8b75-4715-996a-257b9f65451c/code.power +++ b/src/152c8793-8b75-4715-996a-257b9f65451c/code.power @@ -1 +1,78 @@ -###CODEPOWER### \ No newline at end of file + /** + * 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 string|int|null|bool + * + * @since 3.0.9 + */ + public static function bc($type, $val1, $val2, $scale = 0) + { + // Validate input + if (!is_numeric($val1) || !is_numeric($val2)) + { + return null; + } + + // Build function name + $function = 'bc' . $type; + + // Use the bcmath function if available + if (is_callable($function)) + { + return $function($val1, $val2, $scale); + } + + // if function does not exist we use +-*/ operators (fallback - not ideal) + switch ($type) + { + case 'mul': + return (string) round($val1 * $val2, $scale); + case 'div': + if ($val2 == 0) return null; // Avoid division by zero + return (string) round($val1 / $val2, $scale); + case 'add': + return (string) round($val1 + $val2, $scale); + case 'sub': + return (string) round($val1 - $val2, $scale); + case 'pow': + return (string) round(pow($val1, $val2), $scale); + case 'comp': + $diff = round($val1 - $val2, $scale); + return ($diff > 0) ? 1 : (($diff < 0) ? -1 : 0); + } + + return null; + } + + /** + * Basic sum of an array with more precision + * + * @param array $array The values to sum + * @param int $scale The scale value + * + * @return float + * + * @since 3.0.9 + */ + public static function sum($array, $scale = 4) + { + // use the bcadd function if available + if (function_exists('bcadd')) + { + // set the start value + $value = 0.0; + // loop the values and run bcadd + foreach($array as $val) + { + $value = bcadd($value, (string) $val, $scale); + } + return $value; + } + // fall back on array sum + return array_sum($array); + } diff --git a/src/152c8793-8b75-4715-996a-257b9f65451c/settings.json b/src/152c8793-8b75-4715-996a-257b9f65451c/settings.json index 6b3b222..e9c4168 100644 --- a/src/152c8793-8b75-4715-996a-257b9f65451c/settings.json +++ b/src/152c8793-8b75-4715-996a-257b9f65451c/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "152c8793-8b75-4715-996a-257b9f65451c", + "implements": null, + "load_selection": null, + "name": "MathHelper", + "power_version": "1.0.0", + "system_name": "Utilities Math Helper", + "type": "abstract class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Utilities.MathHelper", + "description": "Basic Math Helper\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/README.md b/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/README.md index 433b69e..eb89750 100644 --- a/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/README.md +++ b/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/README.md @@ -1 +1,108 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class StringHelper (Details) +> namespace: **VDM\Joomla\Utilities** +```uml +@startuml +abstract StringHelper #Orange { + + static $langTag + + {static} check($string) : bool + + {static} shorten($string, $length = 40, ...) + + {static} safe($string, $type = 'L', ...) + + {static} transliterate($string) + + {static} html($var, $charset = 'UTF-8', ...) + + {static} numbers($string) + + {static} number($x) + + {static} random(int $size) : string +} + +note right of StringHelper::check + Check if we have a string with a length + + since: 3.0.9 + return: bool +end note + +note left of StringHelper::shorten + Shorten a string + + since: 3.2.0 + + arguments: + $string + $length = 40 + $addTip = true +end note + +note right of StringHelper::safe + Making strings safe (various ways) + + since: 3.0.9 + + arguments: + $string + $type = 'L' + $spacer = '_' + $replaceNumbers = true + $keepOnlyCharacters = true +end note + +note left of StringHelper::transliterate + Convert none English strings to code usable string + + since: 3.0.9 +end note + +note right of StringHelper::html + make sure a string is HTML save + + since: 3.0.9 + + arguments: + $var + $charset = 'UTF-8' + $shorten = false + $length = 40 + $addTip = true +end note + +note left of StringHelper::numbers + Convert all int in a string to an English word string + + since: 3.0.9 +end note + +note right of StringHelper::number + Convert an integer into an English word string +Thanks to Tom Nicholson + + since: 3.0.9 +end note + +note left of StringHelper::random + Random Key + + since: 3.0.9 + return: string +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.php b/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.php index b9a864e..fad2335 100644 --- a/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.php +++ b/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.php @@ -9,4 +9,408 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Language\Language; +use VDM\Joomla\Utilities\Component\Helper; + + +/** + * Some string tricks + * + * @since 3.0.9 + */ +abstract class StringHelper +{ + /** + * The Main Active Language + * + * @var string + * + * @since 3.0.9 + */ + public static $langTag; + + /** + * Check if we have a string with a length + * + * @input string $string The string to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($string): bool + { + return is_string($string) && strlen($string) > 0; + } + + /** + * Shorten a string + * + * @input string The sting that you would like to shorten + * + * @returns string on success + * + * @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, -1, PREG_SPLIT_DELIM_CAPTURE); + $words_count = count((array)$words); + + $word_length = 0; + $last_word = 0; + for (; $last_word < $words_count; ++$last_word) + { + $word_length += strlen($words[$last_word]); + if ($word_length > $length) + { + break; + } + } + + $newString = implode(array_slice($words, 0, $last_word)); + $final = strlen($newString); + if ($initial !== $final && $addTip) + { + $title = self::shorten($string, 400 , false); + return '' . trim($newString) . '...'; + } + elseif ($initial !== $final && !$addTip) + { + return trim($newString) . '...'; + } + } + return $string; + } + + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) + { + if ($replaceNumbers === true) + { + // remove all numbers and replace with English text version (works well only up to millions) + $string = self::numbers($string); + } + // 0nly continue if we have a string + if (self::check($string)) + { + // create file name without the extension that is safe + if ($type === 'filename') + { + // make sure VDM is not in the string + $string = str_replace('VDM', 'vDm', (string) $string); + // Remove anything which isn't a word, whitespace, number + // or any of the following caracters -_() + // If you don't need to handle multi-byte characters + // you can use preg_replace rather than mb_ereg_replace + // Thanks @Łukasz Rysiak! + // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); + $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); + + // http://stackoverflow.com/a/2021729/1429677 + return preg_replace('/\s+/', ' ', (string) $string); + } + // remove all other characters + $string = trim((string) $string); + $string = preg_replace('/'.$spacer.'+/', ' ', $string); + $string = preg_replace('/\s+/', ' ', $string); + // Transliterate string + $string = self::transliterate($string); + // remove all and keep only characters + if ($keepOnlyCharacters) + { + $string = preg_replace("/[^A-Za-z ]/", '', (string) $string); + } + // keep both numbers and characters + else + { + $string = preg_replace("/[^A-Za-z0-9 ]/", '', (string) $string); + } + // select final adaptations + if ($type === 'L' || $type === 'strtolower') + { + // replace white space with underscore + $string = preg_replace('/\s+/', (string) $spacer, (string) $string); + // default is to return lower + return strtolower($string); + } + elseif ($type === 'W') + { + // return a string with all first letter of each word uppercase(no underscore) + return ucwords(strtolower($string)); + } + elseif ($type === 'w' || $type === 'word') + { + // return a string with all lowercase(no underscore) + return strtolower($string); + } + elseif ($type === 'Ww' || $type === 'Word') + { + // return a string with first letter of the first word uppercase and all the rest lowercase(no underscore) + return ucfirst(strtolower($string)); + } + elseif ($type === 'WW' || $type === 'WORD') + { + // return a string with all the uppercase(no underscore) + return strtoupper($string); + } + elseif ($type === 'U' || $type === 'strtoupper') + { + // replace white space with underscore + $string = preg_replace('/\s+/', (string) $spacer, $string); + // return all upper + return strtoupper($string); + } + elseif ($type === 'F' || $type === 'ucfirst') + { + // replace white space with underscore + $string = preg_replace('/\s+/', (string) $spacer, $string); + // return with first character to upper + return ucfirst(strtolower($string)); + } + elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') + { + // convert all words to first letter uppercase + $string = ucwords(strtolower($string)); + // remove white space + $string = preg_replace('/\s+/', '', $string); + // now return first letter lowercase + return lcfirst($string); + } + // return string + return $string; + } + // not a string + return ''; + } + + /** + * Convert none English strings to code usable string + * + * @input an string + * + * @returns a string + * + * @since 3.0.9 + */ + public static function transliterate($string) + { + // set tag only once + if (!self::check(self::$langTag)) + { + // get global value + self::$langTag = Helper::getParams()->get('language', 'en-GB'); + } + + // Transliterate on the language requested + $lang = Language::getInstance(self::$langTag); + + return $lang->transliterate($string); + } + + /** + * make sure a string is HTML save + * + * @input an html string + * + * @returns a string + * + * @since 3.0.9 + */ + public static function html($var, $charset = 'UTF-8', $shorten = false, $length = 40, $addTip = true) + { + if (self::check($var)) + { + $filter = new InputFilter(); + $string = $filter->clean( + html_entity_decode( + htmlentities( + (string) $var, + ENT_COMPAT, + $charset + ) + ), + 'HTML' + ); + if ($shorten) + { + return self::shorten($string, $length, $addTip); + } + return $string; + } + else + { + return ''; + } + } + + /** + * Convert all int in a string to an English word string + * + * @input an string with numbers + * + * @returns a string + * + * @since 3.0.9 + */ + public static function numbers($string) + { + // set numbers array + $numbers = []; + $search_replace= []; + + // first get all numbers + preg_match_all('!\d+!', (string) $string, $numbers); + + // check if we have any numbers + if (isset($numbers[0]) && ArrayHelper::check($numbers[0])) + { + foreach ($numbers[0] as $number) + { + $search_replace[$number] = self::number((int)$number); + } + + // now replace numbers in string + $string = str_replace(array_keys($search_replace), array_values($search_replace), (string) $string); + + // check if we missed any, strange if we did. + return self::numbers($string); + } + + // return the string with no numbers remaining. + return $string; + } + + /** + * Convert an integer into an English word string + * Thanks to Tom Nicholson + * + * @input an int + * @returns a string + * + * @since 3.0.9 + */ + public static function number($x) + { + $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", + "eight", "nine", "ten", "eleven", "twelve", "thirteen", + "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", + "nineteen", "twenty", 30 => "thirty", 40 => "forty", + 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", + 90 => "ninety" ); + + if(!is_numeric($x)) + { + $w = $x; + } + elseif(fmod($x, 1) != 0) + { + $w = $x; + } + else + { + if($x < 0) + { + $w = 'minus '; + $x = -$x; + } + else + { + $w = ''; + // ... now $x is a non-negative integer. + } + + if($x < 21) // 0 to 20 + { + $w .= $nwords[$x]; + } + elseif($x < 100) // 21 to 99 + { + $w .= $nwords[10 * floor($x/10)]; + $r = fmod($x, 10); + if($r > 0) + { + $w .= ' ' . $nwords[$r]; + } + } + elseif($x < 1000) // 100 to 999 + { + $w .= $nwords[floor($x/100)] .' hundred'; + $r = fmod($x, 100); + if($r > 0) + { + $w .= ' and '. self::number($r); + } + } + elseif($x < 1000000) // 1000 to 999999 + { + $w .= self::number(floor($x/1000)) .' thousand'; + $r = fmod($x, 1000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::number($r); + } + } + else // millions + { + $w .= self::number(floor($x/1000000)) .' million'; + $r = fmod($x, 1000000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::number($r); + } + } + } + return $w; + } + + /** + * Random Key + * + * @input int $size The size of the random string + * + * @returns a string + * @since 3.0.9 + */ + public static function random(int $size): string + { + $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; + $key = []; + $bagsize = strlen($bag) - 1; + + for ($i = 0; $i < $size; $i++) + { + $get = rand(0, $bagsize); + $key[] = $bag[$get]; + } + + return implode($key); + } + +} + diff --git a/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.power b/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.power index 69309b0..5407432 100644 --- a/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.power +++ b/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.power @@ -1 +1,387 @@ -###CODEPOWER### \ No newline at end of file + /** + * The Main Active Language + * + * @var string + * + * @since 3.0.9 + */ + public static $langTag; + + /** + * Check if we have a string with a length + * + * @input string $string The string to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($string): bool + { + return is_string($string) && strlen($string) > 0; + } + + /** + * Shorten a string + * + * @input string The sting that you would like to shorten + * + * @returns string on success + * + * @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, -1, PREG_SPLIT_DELIM_CAPTURE); + $words_count = count((array)$words); + + $word_length = 0; + $last_word = 0; + for (; $last_word < $words_count; ++$last_word) + { + $word_length += strlen($words[$last_word]); + if ($word_length > $length) + { + break; + } + } + + $newString = implode(array_slice($words, 0, $last_word)); + $final = strlen($newString); + if ($initial !== $final && $addTip) + { + $title = self::shorten($string, 400 , false); + return '' . trim($newString) . '...'; + } + elseif ($initial !== $final && !$addTip) + { + return trim($newString) . '...'; + } + } + return $string; + } + + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) + { + if ($replaceNumbers === true) + { + // remove all numbers and replace with English text version (works well only up to millions) + $string = self::numbers($string); + } + // 0nly continue if we have a string + if (self::check($string)) + { + // create file name without the extension that is safe + if ($type === 'filename') + { + // make sure VDM is not in the string + $string = str_replace('VDM', 'vDm', (string) $string); + // Remove anything which isn't a word, whitespace, number + // or any of the following caracters -_() + // If you don't need to handle multi-byte characters + // you can use preg_replace rather than mb_ereg_replace + // Thanks @Łukasz Rysiak! + // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); + $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); + + // http://stackoverflow.com/a/2021729/1429677 + return preg_replace('/\s+/', ' ', (string) $string); + } + // remove all other characters + $string = trim((string) $string); + $string = preg_replace('/'.$spacer.'+/', ' ', $string); + $string = preg_replace('/\s+/', ' ', $string); + // Transliterate string + $string = self::transliterate($string); + // remove all and keep only characters + if ($keepOnlyCharacters) + { + $string = preg_replace("/[^A-Za-z ]/", '', (string) $string); + } + // keep both numbers and characters + else + { + $string = preg_replace("/[^A-Za-z0-9 ]/", '', (string) $string); + } + // select final adaptations + if ($type === 'L' || $type === 'strtolower') + { + // replace white space with underscore + $string = preg_replace('/\s+/', (string) $spacer, (string) $string); + // default is to return lower + return strtolower($string); + } + elseif ($type === 'W') + { + // return a string with all first letter of each word uppercase(no underscore) + return ucwords(strtolower($string)); + } + elseif ($type === 'w' || $type === 'word') + { + // return a string with all lowercase(no underscore) + return strtolower($string); + } + elseif ($type === 'Ww' || $type === 'Word') + { + // return a string with first letter of the first word uppercase and all the rest lowercase(no underscore) + return ucfirst(strtolower($string)); + } + elseif ($type === 'WW' || $type === 'WORD') + { + // return a string with all the uppercase(no underscore) + return strtoupper($string); + } + elseif ($type === 'U' || $type === 'strtoupper') + { + // replace white space with underscore + $string = preg_replace('/\s+/', (string) $spacer, $string); + // return all upper + return strtoupper($string); + } + elseif ($type === 'F' || $type === 'ucfirst') + { + // replace white space with underscore + $string = preg_replace('/\s+/', (string) $spacer, $string); + // return with first character to upper + return ucfirst(strtolower($string)); + } + elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') + { + // convert all words to first letter uppercase + $string = ucwords(strtolower($string)); + // remove white space + $string = preg_replace('/\s+/', '', $string); + // now return first letter lowercase + return lcfirst($string); + } + // return string + return $string; + } + // not a string + return ''; + } + + /** + * Convert none English strings to code usable string + * + * @input an string + * + * @returns a string + * + * @since 3.0.9 + */ + public static function transliterate($string) + { + // set tag only once + if (!self::check(self::$langTag)) + { + // get global value + self::$langTag = Helper::getParams()->get('language', 'en-GB'); + } + + // Transliterate on the language requested + $lang = Language::getInstance(self::$langTag); + + return $lang->transliterate($string); + } + + /** + * make sure a string is HTML save + * + * @input an html string + * + * @returns a string + * + * @since 3.0.9 + */ + public static function html($var, $charset = 'UTF-8', $shorten = false, $length = 40, $addTip = true) + { + if (self::check($var)) + { + $filter = new InputFilter(); + $string = $filter->clean( + html_entity_decode( + htmlentities( + (string) $var, + ENT_COMPAT, + $charset + ) + ), + 'HTML' + ); + if ($shorten) + { + return self::shorten($string, $length, $addTip); + } + return $string; + } + else + { + return ''; + } + } + + /** + * Convert all int in a string to an English word string + * + * @input an string with numbers + * + * @returns a string + * + * @since 3.0.9 + */ + public static function numbers($string) + { + // set numbers array + $numbers = []; + $search_replace= []; + + // first get all numbers + preg_match_all('!\d+!', (string) $string, $numbers); + + // check if we have any numbers + if (isset($numbers[0]) && ArrayHelper::check($numbers[0])) + { + foreach ($numbers[0] as $number) + { + $search_replace[$number] = self::number((int)$number); + } + + // now replace numbers in string + $string = str_replace(array_keys($search_replace), array_values($search_replace), (string) $string); + + // check if we missed any, strange if we did. + return self::numbers($string); + } + + // return the string with no numbers remaining. + return $string; + } + + /** + * Convert an integer into an English word string + * Thanks to Tom Nicholson + * + * @input an int + * @returns a string + * + * @since 3.0.9 + */ + public static function number($x) + { + $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", + "eight", "nine", "ten", "eleven", "twelve", "thirteen", + "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", + "nineteen", "twenty", 30 => "thirty", 40 => "forty", + 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", + 90 => "ninety" ); + + if(!is_numeric($x)) + { + $w = $x; + } + elseif(fmod($x, 1) != 0) + { + $w = $x; + } + else + { + if($x < 0) + { + $w = 'minus '; + $x = -$x; + } + else + { + $w = ''; + // ... now $x is a non-negative integer. + } + + if($x < 21) // 0 to 20 + { + $w .= $nwords[$x]; + } + elseif($x < 100) // 21 to 99 + { + $w .= $nwords[10 * floor($x/10)]; + $r = fmod($x, 10); + if($r > 0) + { + $w .= ' ' . $nwords[$r]; + } + } + elseif($x < 1000) // 100 to 999 + { + $w .= $nwords[floor($x/100)] .' hundred'; + $r = fmod($x, 100); + if($r > 0) + { + $w .= ' and '. self::number($r); + } + } + elseif($x < 1000000) // 1000 to 999999 + { + $w .= self::number(floor($x/1000)) .' thousand'; + $r = fmod($x, 1000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::number($r); + } + } + else // millions + { + $w .= self::number(floor($x/1000000)) .' million'; + $r = fmod($x, 1000000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::number($r); + } + } + } + return $w; + } + + /** + * Random Key + * + * @input int $size The size of the random string + * + * @returns a string + * @since 3.0.9 + */ + public static function random(int $size): string + { + $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; + $key = []; + $bagsize = strlen($bag) - 1; + + for ($i = 0; $i < $size; $i++) + { + $get = rand(0, $bagsize); + $key[] = $bag[$get]; + } + + return implode($key); + } diff --git a/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/settings.json b/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/settings.json index 6b3b222..cf66879 100644 --- a/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/settings.json +++ b/src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/settings.json @@ -1 +1,27 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "0", + "guid": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef", + "implements": null, + "load_selection": { + "load_selection0": { + "load": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a" + } + }, + "name": "StringHelper", + "power_version": "1.0.0", + "system_name": "Utilities String Helper", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "640b5352-fb09-425f-a26e-cd44eda03f15", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Utilities.StringHelper", + "description": "Some string tricks\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 \r\n * @git 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\\CMS\\Filter\\InputFilter;\r\nuse Joomla\\CMS\\Language\\Language;", + "composer": "" +} \ No newline at end of file diff --git a/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/README.md b/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/README.md index 433b69e..93fd3e9 100644 --- a/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/README.md +++ b/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/README.md @@ -1 +1,37 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# trait InArray (Details) +> namespace: **VDM\Joomla\Abstraction\Registry\Traits** +```uml +@startuml +class InArray << (T,Orange) >> #Turquoise { + + inArray(mixed $value, ?string $path = null) : bool +} + +note right of InArray::inArray + Check if a value is found in an array + + since: 3.2.0 + return: bool +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.php b/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.php index 26c1a50..9bcd708 100644 --- a/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.php +++ b/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.php @@ -9,4 +9,42 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction\Registry\Traits; + + +/** + * Check if a value is in an array + * + * @since 3.2.0 + */ +trait InArray +{ + /** + * Check if a value is found in an array + * + * @param mixed $value The value to check for + * @param string|null $path Registry path (e.g. joomla.content.showauthor) + * + * @return bool + * @since 3.2.0 + */ + public function inArray($value, ?string $path = null): bool + { + // Check base array if no path is given + if (empty($path)) + { + return in_array($value, $this->active); + } + + // get the value + if (($node = $this->get($path)) !== null + && is_array($node) + && in_array($value, $node)) + { + return true; + } + + return false; + } +} + diff --git a/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.power b/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.power index 69309b0..b465002 100644 --- a/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.power +++ b/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.power @@ -1 +1,27 @@ -###CODEPOWER### \ No newline at end of file + /** + * Check if a value is found in an array + * + * @param mixed $value The value to check for + * @param string|null $path Registry path (e.g. joomla.content.showauthor) + * + * @return bool + * @since 3.2.0 + */ + public function inArray($value, ?string $path = null): bool + { + // Check base array if no path is given + if (empty($path)) + { + return in_array($value, $this->active); + } + + // get the value + if (($node = $this->get($path)) !== null + && is_array($node) + && in_array($value, $node)) + { + return true; + } + + return false; + } \ No newline at end of file diff --git a/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/settings.json b/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/settings.json index 6b3b222..4881cde 100644 --- a/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/settings.json +++ b/src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "215b35ac-1b26-4838-bbcf-d1fdbbd9353f", + "implements": null, + "load_selection": null, + "name": "InArray", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.Registry.Traits.InArray", + "type": "trait", + "use_selection": null, + "namespace": "VDM\\Joomla\\Abstraction.Registry.Traits.InArray", + "description": "Check if a value is in an array\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/README.md b/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/README.md index 433b69e..3d933eb 100644 --- a/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/README.md +++ b/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/README.md @@ -1 +1,122 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# interface LoadInterface (Details) +> namespace: **VDM\Joomla\Interfaces** +```uml +@startuml +interface LoadInterface #Lavender { + + rows(array $select, array $tables, ...) : ?array + + items(array $select, array $tables, ...) : ?array + + row(array $select, array $tables, ...) : ?array + + item(array $select, array $tables, ...) : ?object + + max(string $field, array $tables, ...) : ?int + + count(array $tables, array $filter) : ?int + + value(array $select, array $tables, ...) : mixed +} + +note right of LoadInterface::rows + Load data rows as an array of associated arrays + + since: 3.2.0 + return: ?array + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null + ?int $limit = null +end note + +note right of LoadInterface::items + Load data rows as an array of objects + + since: 3.2.0 + return: ?array + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null + ?int $limit = null +end note + +note right of LoadInterface::row + Load data row as an associated array + + since: 3.2.0 + return: ?array + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null +end note + +note right of LoadInterface::item + Load data row as an object + + since: 3.2.0 + return: ?object + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null +end note + +note right of LoadInterface::max + Get the max value based on a filtered result from a given table + + since: 3.2.0 + return: ?int + + arguments: + string $field + array $tables + array $filter +end note + +note right of LoadInterface::count + Count the number of items based on filter result from a given table + + since: 3.2.0 + return: ?int +end note + +note right of LoadInterface::value + Load one value from a row + + since: 3.2.0 + return: mixed + + arguments: + array $select + array $tables + ?array $where = null + ?array $order = null +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.php b/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.php index 26c1a50..31017c5 100644 --- a/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.php +++ b/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.php @@ -9,4 +9,106 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Interfaces; + + +/** + * Database Load Interface + * + * @since 3.2.0 + */ +interface LoadInterface +{ + /** + * Load data rows as an array of associated arrays + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return array|null + * @since 3.2.0 + **/ + public function rows(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): ?array; + + /** + * Load data rows as an array of objects + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return array|null + * @since 3.2.0 + **/ + public function items(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): ?array; + + /** + * Load data row as an associated array + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return array|null + * @since 3.2.0 + **/ + public function row(array $select, array $tables, ?array $where = null, ?array $order = null): ?array; + + /** + * Load data row as an object + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return object|null + * @since 3.2.0 + **/ + public function item(array $select, array $tables, ?array $where = null, ?array $order = null): ?object; + + /** + * Get the max value based on a filtered result from a given table + * + * @param string $field The field key + * @param string $tables The table + * @param array $filter The filter keys + * + * @return int|null + * @since 3.2.0 + **/ + public function max($field, array $tables, array $filter): ?int; + + /** + * Count the number of items based on filter result from a given table + * + * @param string $tables The table + * @param array $filter The filter keys + * + * @return int|null + * @since 3.2.0 + **/ + public function count(array $tables, array $filter): ?int; + + /** + * Load one value from a row + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return mixed + * @since 3.2.0 + **/ + public function value(array $select, array $tables, ?array $where = null, ?array $order = null); +} + diff --git a/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.power b/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.power index 69309b0..46ae072 100644 --- a/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.power +++ b/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.power @@ -1 +1,91 @@ -###CODEPOWER### \ No newline at end of file + /** + * Load data rows as an array of associated arrays + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return array|null + * @since 3.2.0 + **/ + public function rows(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): ?array; + + /** + * Load data rows as an array of objects + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * @param int|null $limit Limit the number of values returned + * + * @return array|null + * @since 3.2.0 + **/ + public function items(array $select, array $tables, ?array $where = null, + ?array $order = null, ?int $limit = null): ?array; + + /** + * Load data row as an associated array + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return array|null + * @since 3.2.0 + **/ + public function row(array $select, array $tables, ?array $where = null, ?array $order = null): ?array; + + /** + * Load data row as an object + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return object|null + * @since 3.2.0 + **/ + public function item(array $select, array $tables, ?array $where = null, ?array $order = null): ?object; + + /** + * Get the max value based on a filtered result from a given table + * + * @param string $field The field key + * @param string $tables The table + * @param array $filter The filter keys + * + * @return int|null + * @since 3.2.0 + **/ + public function max($field, array $tables, array $filter): ?int; + + /** + * Count the number of items based on filter result from a given table + * + * @param string $tables The table + * @param array $filter The filter keys + * + * @return int|null + * @since 3.2.0 + **/ + public function count(array $tables, array $filter): ?int; + + /** + * Load one value from a row + * + * @param array $select Array of selection keys + * @param array $tables Array of tables to search + * @param array|null $where Array of where key=>value match exist + * @param array|null $order Array of how to order the data + * + * @return mixed + * @since 3.2.0 + **/ + public function value(array $select, array $tables, ?array $where = null, ?array $order = null); \ No newline at end of file diff --git a/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/settings.json b/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/settings.json index 6b3b222..6744ec2 100644 --- a/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/settings.json +++ b/src/2ad31f74-f579-499d-b98b-c4f54fd615dd/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "2ad31f74-f579-499d-b98b-c4f54fd615dd", + "implements": null, + "load_selection": null, + "name": "LoadInterface", + "power_version": "1.0.0", + "system_name": "VDM.Interfaces.LoadInterface", + "type": "interface", + "use_selection": null, + "namespace": "VDM\\Joomla\\Interfaces.LoadInterface", + "description": "Database Load Interface\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/README.md b/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/README.md index 433b69e..4832acd 100644 --- a/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/README.md +++ b/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/README.md @@ -1 +1,89 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# interface Tableinterface (Details) +> namespace: **VDM\Joomla\Interfaces** +```uml +@startuml +interface Tableinterface #Lavender { + + get(string $table, ?string $field = null, ...) : mixed + + title(string $table) : ?array + + titleName(string $table) : string + + tables() : array + + exist(string $table, ?string $field = null) : bool + + fields(string $table, bool $default = false) : ?array +} + +note right of Tableinterface::get + Get any value from a item/field/column of an area/view/table +Example: $this->get('table_name', 'field_name', 'value_key'); +Get an item/field/column of an area/view/table +Example: $this->get('table_name', 'field_name'); +Get all items/fields/columns of an area/view/table +Example: $this->get('table_name'); +Get all areas/views/tables with all their item/field/column details +Example: $this->get('All'); + + since: 3.2.0 + return: mixed + + arguments: + string $table + ?string $field = null + ?string $key = null +end note + +note right of Tableinterface::title + Get title field from an area/view/table + + since: 3.2.0 + return: ?array +end note + +note right of Tableinterface::titleName + Get title field name + + since: 3.2.0 + return: string +end note + +note right of Tableinterface::tables + Get all tables + + since: 3.2.0 + return: array +end note + +note right of Tableinterface::exist + Check if a table (and field) exist + + since: 3.2.0 + return: bool +end note + +note right of Tableinterface::fields + Get all fields of an area/view/table + + since: 3.2.0 + return: ?array +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php b/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php index 26c1a50..4d8f741 100644 --- a/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php +++ b/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php @@ -9,4 +9,81 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Interfaces; + + +/** + * The VDM Core Table Interface + */ +interface Tableinterface +{ + /** + * Get any value from a item/field/column of an area/view/table + * Example: $this->get('table_name', 'field_name', 'value_key'); + * Get an item/field/column of an area/view/table + * Example: $this->get('table_name', 'field_name'); + * Get all items/fields/columns of an area/view/table + * Example: $this->get('table_name'); + * Get all areas/views/tables with all their item/field/column details + * Example: $this->get('All'); + * + * @param string $table The table + * @param string|null $field The field + * @param string|null $key The value key + * + * @return mixed + * @since 3.2.0 + */ + public function get(string $table, ?string $field = null, ?string $key = null); + + /** + * Get title field from an area/view/table + * + * @param string $table The area + * + * @return ?array + * @since 3.2.0 + */ + public function title(string $table): ?array; + + /** + * Get title field name + * + * @param string $table The area + * + * @return string + * @since 3.2.0 + */ + public function titleName(string $table): string; + + /** + * Get all tables + * + * @return array + * @since 3.2.0 + */ + public function tables(): array; + + /** + * Check if a table (and field) exist + * + * @param string $table The area + * @param string|null $field The area + * + * @return bool + * @since 3.2.0 + */ + public function exist(string $table, ?string $field = null): bool; + + /** + * Get all fields of an area/view/table + * + * @param string $table The area + * @param bool $default Add the default fields + * + * @return array|null On success an array of fields + * @since 3.2.0 + */ + public function fields(string $table, bool $default = false): ?array; +} + diff --git a/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.power b/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.power index 69309b0..cd80a33 100644 --- a/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.power +++ b/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.power @@ -1 +1,68 @@ -###CODEPOWER### \ No newline at end of file + /** + * Get any value from a item/field/column of an area/view/table + * Example: $this->get('table_name', 'field_name', 'value_key'); + * Get an item/field/column of an area/view/table + * Example: $this->get('table_name', 'field_name'); + * Get all items/fields/columns of an area/view/table + * Example: $this->get('table_name'); + * Get all areas/views/tables with all their item/field/column details + * Example: $this->get('All'); + * + * @param string $table The table + * @param string|null $field The field + * @param string|null $key The value key + * + * @return mixed + * @since 3.2.0 + */ + public function get(string $table, ?string $field = null, ?string $key = null); + + /** + * Get title field from an area/view/table + * + * @param string $table The area + * + * @return ?array + * @since 3.2.0 + */ + public function title(string $table): ?array; + + /** + * Get title field name + * + * @param string $table The area + * + * @return string + * @since 3.2.0 + */ + public function titleName(string $table): string; + + /** + * Get all tables + * + * @return array + * @since 3.2.0 + */ + public function tables(): array; + + /** + * Check if a table (and field) exist + * + * @param string $table The area + * @param string|null $field The area + * + * @return bool + * @since 3.2.0 + */ + public function exist(string $table, ?string $field = null): bool; + + /** + * Get all fields of an area/view/table + * + * @param string $table The area + * @param bool $default Add the default fields + * + * @return array|null On success an array of fields + * @since 3.2.0 + */ + public function fields(string $table, bool $default = false): ?array; \ No newline at end of file diff --git a/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json b/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json index 6b3b222..86f0592 100644 --- a/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json +++ b/src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "2da6d6c4-eb29-4d69-8bc2-36d96e916adf", + "implements": null, + "load_selection": null, + "name": "Tableinterface", + "power_version": "1.0.0", + "system_name": "VDM.Interfaces.Tableinterface", + "type": "interface", + "use_selection": null, + "namespace": "VDM\\Joomla\\Interfaces.Tableinterface", + "description": "The VDM Core Table Interface", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/README.md b/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/README.md index 433b69e..92c14b5 100644 --- a/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/README.md +++ b/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/README.md @@ -1 +1,37 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class ClassfunctionHelper (Details) +> namespace: **VDM\Joomla\Utilities\String** +```uml +@startuml +abstract ClassfunctionHelper #Orange { + + {static} safe($name) : string +} + +note right of ClassfunctionHelper::safe + Making class or function name safe + + since: 3.0.9 + return: string +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/code.php b/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/code.php index b9a864e..42d21af 100644 --- a/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/code.php +++ b/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/code.php @@ -9,4 +9,39 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities\String; + + +use VDM\Joomla\Utilities\StringHelper; + + +/** + * Control the naming of a class and function + * + * @since 3.0.9 + */ +abstract class ClassfunctionHelper +{ + /** + * Making class or function name safe + * + * @input string The name you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($name): string + { + // remove numbers if the first character is a number + if (is_numeric(substr((string) $name, 0, 1))) + { + $name = StringHelper::numbers($name); + } + + // remove all spaces and strange characters + return trim(preg_replace("/[^A-Za-z0-9_-]/", '', (string) $name)); + } + +} + diff --git a/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/code.power b/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/code.power index 69309b0..e3d3764 100644 --- a/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/code.power +++ b/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/code.power @@ -1 +1,20 @@ -###CODEPOWER### \ No newline at end of file + /** + * Making class or function name safe + * + * @input string The name you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($name): string + { + // remove numbers if the first character is a number + if (is_numeric(substr((string) $name, 0, 1))) + { + $name = StringHelper::numbers($name); + } + + // remove all spaces and strange characters + return trim(preg_replace("/[^A-Za-z0-9_-]/", '', (string) $name)); + } diff --git a/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/settings.json b/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/settings.json index 6b3b222..572ee07 100644 --- a/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/settings.json +++ b/src/30c5b4c2-f75f-4d15-869a-f8bfedd87358/settings.json @@ -1 +1,23 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "30c5b4c2-f75f-4d15-869a-f8bfedd87358", + "implements": null, + "load_selection": null, + "name": "ClassfunctionHelper", + "power_version": "1.0.0", + "system_name": "String Classfunction Helper", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Utilities.String.ClassfunctionHelper", + "description": "Control the naming of a class and function\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/README.md b/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/README.md index 433b69e..624c984 100644 --- a/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/README.md +++ b/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/README.md @@ -1 +1,61 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class PluginHelper (Details) +> namespace: **VDM\Joomla\Utilities\String** +```uml +@startuml +abstract PluginHelper #Orange { + + {static} safeFolderName(string $codeName, string $group) : string + + {static} safeClassName(string $codeName, string $group) : string + + {static} safeInstallClassName(string $codeName, string $group) : string + + {static} safeLangPrefix(string $codeName, string $group) : string +} + +note right of PluginHelper::safeFolderName + Making plugin folder name safe + + since: 3.0.9 + return: string +end note + +note right of PluginHelper::safeClassName + Making plugin class name safe + + since: 3.0.9 + return: string +end note + +note right of PluginHelper::safeInstallClassName + Making plugin install class name safe + + since: 3.0.9 + return: string +end note + +note right of PluginHelper::safeLangPrefix + Making language prefix safe + + since: 3.0.9 + return: string +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/code.php b/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/code.php index b9a864e..1b31ffd 100644 --- a/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/code.php +++ b/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/code.php @@ -9,4 +9,107 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities\String; + + +/** + * Control the naming of a plugin + * + * @since 3.0.9 + */ +abstract class PluginHelper +{ + /** + * Making plugin folder name safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeFolderName(string $codeName, string $group): string + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'plg_' . strtolower($group) . '_' . strtolower( + $codeName + ); + } + + /** + * Making plugin class name safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeClassName(string $codeName, string $group): string + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'Plg' . ucfirst($group) . ucfirst( + $codeName + ); + } + + /** + * Making plugin install class name safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeInstallClassName(string $codeName, string $group): string + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'plg' . ucfirst($group) . ucfirst( + $codeName + ) . 'InstallerScript'; + } + + /** + * Making language prefix safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeLangPrefix(string $codeName, string $group): string + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'PLG_' . strtoupper($group) . '_' . strtoupper( + $codeName + ); + } + +} + diff --git a/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/code.power b/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/code.power index 69309b0..ec9b01f 100644 --- a/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/code.power +++ b/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/code.power @@ -1 +1,91 @@ -###CODEPOWER### \ No newline at end of file + /** + * Making plugin folder name safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeFolderName(string $codeName, string $group): string + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'plg_' . strtolower($group) . '_' . strtolower( + $codeName + ); + } + + /** + * Making plugin class name safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeClassName(string $codeName, string $group): string + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'Plg' . ucfirst($group) . ucfirst( + $codeName + ); + } + + /** + * Making plugin install class name safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeInstallClassName(string $codeName, string $group): string + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'plg' . ucfirst($group) . ucfirst( + $codeName + ) . 'InstallerScript'; + } + + /** + * Making language prefix safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeLangPrefix(string $codeName, string $group): string + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'PLG_' . strtoupper($group) . '_' . strtoupper( + $codeName + ); + } diff --git a/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/settings.json b/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/settings.json index 6b3b222..c9afb7e 100644 --- a/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/settings.json +++ b/src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "3cf76fbf-fd95-4a33-878e-7aff6d36b7f6", + "implements": null, + "load_selection": null, + "name": "PluginHelper", + "power_version": "1.0.0", + "system_name": "String Plugin Helper", + "type": "abstract class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Utilities.String.PluginHelper", + "description": "Control the naming of a plugin\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/43134867-5cb8-4280-9be8-309fd2fd135f/README.md b/src/43134867-5cb8-4280-9be8-309fd2fd135f/README.md index 433b69e..b6eada5 100644 --- a/src/43134867-5cb8-4280-9be8-309fd2fd135f/README.md +++ b/src/43134867-5cb8-4280-9be8-309fd2fd135f/README.md @@ -1 +1,103 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class ActiveRegistry (Details) +> namespace: **VDM\Joomla\Abstraction** +```uml +@startuml +abstract ActiveRegistry #Orange { + # array $active + # bool $addAsArray + + isActive() : bool + + allActive() : array + + setActive(mixed $value, $keys) : void + + addActive(mixed $value, ?bool $asArray, ...) : void + + getActive(mixed $default, $keys) : mixed + + removeActive($keys) : void + + existsActive($keys) : bool + # validActiveKeys(array $keys) : bool +} + +note right of ActiveRegistry::isActive + Check if the registry has any content. + + since: 3.2.0 + return: bool +end note + +note left of ActiveRegistry::allActive + Get all value from the active registry. + + since: 3.2.0 + return: array +end note + +note right of ActiveRegistry::setActive + Sets a value into the registry using multiple keys. + + since: 3.2.0 + return: void +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 + $keys +end note + +note right of ActiveRegistry::getActive + Retrieves a value (or sub-array) from the registry using multiple keys. + + since: 3.2.0 + return: mixed +end note + +note left of ActiveRegistry::removeActive + Removes a value (or sub-array) from the registry using multiple keys. + + since: 3.2.0 + return: void +end note + +note right of ActiveRegistry::existsActive + Checks the existence of a particular location in the registry using multiple keys. + + since: 3.2.0 + return: bool +end note + +note left of ActiveRegistry::validActiveKeys + Checks that the keys are valid + + since: 3.2.0 + return: bool +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/43134867-5cb8-4280-9be8-309fd2fd135f/code.php b/src/43134867-5cb8-4280-9be8-309fd2fd135f/code.php index 26c1a50..861fcf9 100644 --- a/src/43134867-5cb8-4280-9be8-309fd2fd135f/code.php +++ b/src/43134867-5cb8-4280-9be8-309fd2fd135f/code.php @@ -9,4 +9,280 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction; + + +use VDM\Joomla\Interfaces\Activeregistryinterface; + + +/** + * Active Storage Registry. + * + * Don't use this beyond 10 dimensional depth for best performance. + * + * @since 3.2.0 + */ +abstract class ActiveRegistry implements Activeregistryinterface +{ + /** + * The registry array. + * + * @var array + * @since 3.2.0 + **/ + 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. + * + * @return bool Returns true if the active array is not empty, false otherwise. + * @since 3.2.0 + */ + public function isActive(): bool + { + return !empty($this->active); + } + + /** + * Get all value from the active registry. + * + * @return array The values or empty array. + * @since 3.2.0 + */ + public function allActive(): array + { + return $this->active; + } + + /** + * Sets a value into the registry using multiple keys. + * + * @param mixed $value The value to set. + * @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 setActive($value, string ...$keys): void + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to set any value."); + } + + $array = &$this->active; + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + if (!is_array($array)) + { + $path = '[' . implode('][', $keys) . ']'; + throw new \InvalidArgumentException("Attempted to use key '{$key}' on a non-array value: {$array}. Path: {$path} Value: {$value}"); + } + + $array[$key] = []; + } + $array = &$array[$key]; + } + + $array = $value; + } + + /** + * 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|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 + { + 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) + { + if (!isset($array[$key])) + { + if (!is_array($array)) + { + $path = '[' . implode('][', $keys) . ']'; + throw new \InvalidArgumentException("Attempted to use key '{$key}' on a non-array value: {$array}. Path: {$path} Value: {$value}"); + } + + $array[$key] = []; + } + $array = &$array[$key]; + } + + // add string + if (!$asArray && $array === []) + { + $array = ''; + } + + // Handle the adding logic at the tip of the array + if (is_array($array) || $asArray) + { + if (!is_array($array)) + { + // Convert to array if it's not already an array + $array = [$array]; + } + $array[] = $value; + } + else + { + if (is_string($value) || is_numeric($value)) + { + $array .= (string) $value; + } + else + { + $array = $value; + } + } + } + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param mixed $default The default value if not set. + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function getActive($default, string ...$keys) + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to get any value."); + } + + $array = $this->active; + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + return $default; + } + $array = $array[$key]; + } + + return $array; + } + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @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 removeActive(string ...$keys): void + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to remove any value."); + } + + $array = &$this->active; + $lastKey = array_pop($keys); + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + return; // Exit early if the key doesn't exist + } + $array = &$array[$key]; + } + + unset($array[$lastKey]); + } + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function existsActive(string ...$keys): bool + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to check if any value exist."); + } + + $array = $this->active; + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + return false; + } + $array = $array[$key]; + } + + return true; + } + + /** + * Checks that the keys are valid + * + * @param array $keys The keys to determine the location. + * + * @return bool False if any of the keys are not a number or string. + * @since 3.2.0 + */ + protected function validActiveKeys(array $keys): bool + { + foreach ($keys as $key) + { + if ($key === '' || (!is_string($key) && !is_numeric($key))) + { + return false; + } + } + + return true; + } +} + diff --git a/src/43134867-5cb8-4280-9be8-309fd2fd135f/code.power b/src/43134867-5cb8-4280-9be8-309fd2fd135f/code.power index 69309b0..01684b7 100644 --- a/src/43134867-5cb8-4280-9be8-309fd2fd135f/code.power +++ b/src/43134867-5cb8-4280-9be8-309fd2fd135f/code.power @@ -1 +1,260 @@ -###CODEPOWER### \ No newline at end of file + /** + * The registry array. + * + * @var array + * @since 3.2.0 + **/ + 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. + * + * @return bool Returns true if the active array is not empty, false otherwise. + * @since 3.2.0 + */ + public function isActive(): bool + { + return !empty($this->active); + } + + /** + * Get all value from the active registry. + * + * @return array The values or empty array. + * @since 3.2.0 + */ + public function allActive(): array + { + return $this->active; + } + + /** + * Sets a value into the registry using multiple keys. + * + * @param mixed $value The value to set. + * @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 setActive($value, string ...$keys): void + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to set any value."); + } + + $array = &$this->active; + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + if (!is_array($array)) + { + $path = '[' . implode('][', $keys) . ']'; + throw new \InvalidArgumentException("Attempted to use key '{$key}' on a non-array value: {$array}. Path: {$path} Value: {$value}"); + } + + $array[$key] = []; + } + $array = &$array[$key]; + } + + $array = $value; + } + + /** + * 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|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 + { + 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) + { + if (!isset($array[$key])) + { + if (!is_array($array)) + { + $path = '[' . implode('][', $keys) . ']'; + throw new \InvalidArgumentException("Attempted to use key '{$key}' on a non-array value: {$array}. Path: {$path} Value: {$value}"); + } + + $array[$key] = []; + } + $array = &$array[$key]; + } + + // add string + if (!$asArray && $array === []) + { + $array = ''; + } + + // Handle the adding logic at the tip of the array + if (is_array($array) || $asArray) + { + if (!is_array($array)) + { + // Convert to array if it's not already an array + $array = [$array]; + } + $array[] = $value; + } + else + { + if (is_string($value) || is_numeric($value)) + { + $array .= (string) $value; + } + else + { + $array = $value; + } + } + } + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param mixed $default The default value if not set. + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function getActive($default, string ...$keys) + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to get any value."); + } + + $array = $this->active; + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + return $default; + } + $array = $array[$key]; + } + + return $array; + } + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @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 removeActive(string ...$keys): void + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to remove any value."); + } + + $array = &$this->active; + $lastKey = array_pop($keys); + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + return; // Exit early if the key doesn't exist + } + $array = &$array[$key]; + } + + unset($array[$lastKey]); + } + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function existsActive(string ...$keys): bool + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to check if any value exist."); + } + + $array = $this->active; + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + return false; + } + $array = $array[$key]; + } + + return true; + } + + /** + * Checks that the keys are valid + * + * @param array $keys The keys to determine the location. + * + * @return bool False if any of the keys are not a number or string. + * @since 3.2.0 + */ + protected function validActiveKeys(array $keys): bool + { + foreach ($keys as $key) + { + if ($key === '' || (!is_string($key) && !is_numeric($key))) + { + return false; + } + } + + return true; + } \ No newline at end of file diff --git a/src/43134867-5cb8-4280-9be8-309fd2fd135f/settings.json b/src/43134867-5cb8-4280-9be8-309fd2fd135f/settings.json index 6b3b222..e47c444 100644 --- a/src/43134867-5cb8-4280-9be8-309fd2fd135f/settings.json +++ b/src/43134867-5cb8-4280-9be8-309fd2fd135f/settings.json @@ -1 +1,20 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "43134867-5cb8-4280-9be8-309fd2fd135f", + "implements": [ + "af0eedbe-603b-4671-8e5a-28165d88254b" + ], + "load_selection": null, + "name": "ActiveRegistry", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.ActiveRegistry", + "type": "abstract class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Abstraction.ActiveRegistry", + "description": "Active Storage Registry.\r\n\r\nDon't use this beyond 10 dimensional depth for best performance.\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/4815e1c7-a433-443d-a112-d1e03d7df84b/README.md b/src/4815e1c7-a433-443d-a112-d1e03d7df84b/README.md index 433b69e..9899434 100644 --- a/src/4815e1c7-a433-443d-a112-d1e03d7df84b/README.md +++ b/src/4815e1c7-a433-443d-a112-d1e03d7df84b/README.md @@ -1 +1,61 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# class Database (Details) +> namespace: **VDM\Joomla\Componentbuilder\Service** +```uml +@startuml +class Database #Gold { + + register(Container $container) : void + + getLoad(Container $container) : Load + + getInsert(Container $container) : Insert + + getUpdate(Container $container) : Update +} + +note right of Database::register + Registers the service provider with a DI container. + + since: 3.2.0 + return: void +end note + +note right of Database::getLoad + Get the Core Load Database + + since: 3.2.0 + return: Load +end note + +note right of Database::getInsert + Get the Core Insert Database + + since: 3.2.0 + return: Insert +end note + +note right of Database::getUpdate + Get the Core Update Database + + since: 3.2.0 + return: Update +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/4815e1c7-a433-443d-a112-d1e03d7df84b/code.php b/src/4815e1c7-a433-443d-a112-d1e03d7df84b/code.php index 26c1a50..c5a417b 100644 --- a/src/4815e1c7-a433-443d-a112-d1e03d7df84b/code.php +++ b/src/4815e1c7-a433-443d-a112-d1e03d7df84b/code.php @@ -9,4 +9,80 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Componentbuilder\Service; + + +use Joomla\DI\Container; +use Joomla\DI\ServiceProviderInterface; +use VDM\Joomla\Database\Load; +use VDM\Joomla\Database\Insert; +use VDM\Joomla\Database\Update; + + +/** + * Database Service Provider + * + * @since 3.2.0 + */ +class Database implements ServiceProviderInterface +{ + /** + * Registers the service provider with a DI container. + * + * @param Container $container The DI container. + * + * @return void + * @since 3.2.0 + */ + public function register(Container $container) + { + $container->alias(Load::class, 'Load') + ->share('Load', [$this, 'getLoad'], true); + + $container->alias(Insert::class, 'Insert') + ->share('Insert', [$this, 'getInsert'], true); + + $container->alias(Update::class, 'Update') + ->share('Update', [$this, 'getUpdate'], true); + } + + /** + * Get the Core Load Database + * + * @param Container $container The DI container. + * + * @return Load + * @since 3.2.0 + */ + public function getLoad(Container $container): Load + { + return new Load(); + } + + /** + * Get the Core Insert Database + * + * @param Container $container The DI container. + * + * @return Insert + * @since 3.2.0 + */ + public function getInsert(Container $container): Insert + { + return new Insert(); + } + + /** + * Get the Core Update Database + * + * @param Container $container The DI container. + * + * @return Update + * @since 3.2.0 + */ + public function getUpdate(Container $container): Update + { + return new Update(); + } +} + diff --git a/src/4815e1c7-a433-443d-a112-d1e03d7df84b/code.power b/src/4815e1c7-a433-443d-a112-d1e03d7df84b/code.power index 69309b0..1ca19e7 100644 --- a/src/4815e1c7-a433-443d-a112-d1e03d7df84b/code.power +++ b/src/4815e1c7-a433-443d-a112-d1e03d7df84b/code.power @@ -1 +1,58 @@ -###CODEPOWER### \ No newline at end of file + /** + * Registers the service provider with a DI container. + * + * @param Container $container The DI container. + * + * @return void + * @since 3.2.0 + */ + public function register(Container $container) + { + $container->alias(Load::class, 'Load') + ->share('Load', [$this, 'getLoad'], true); + + $container->alias(Insert::class, 'Insert') + ->share('Insert', [$this, 'getInsert'], true); + + $container->alias(Update::class, 'Update') + ->share('Update', [$this, 'getUpdate'], true); + } + + /** + * Get the Core Load Database + * + * @param Container $container The DI container. + * + * @return Load + * @since 3.2.0 + */ + public function getLoad(Container $container): Load + { + return new Load(); + } + + /** + * Get the Core Insert Database + * + * @param Container $container The DI container. + * + * @return Insert + * @since 3.2.0 + */ + public function getInsert(Container $container): Insert + { + return new Insert(); + } + + /** + * Get the Core Update Database + * + * @param Container $container The DI container. + * + * @return Update + * @since 3.2.0 + */ + public function getUpdate(Container $container): Update + { + return new Update(); + } \ No newline at end of file diff --git a/src/4815e1c7-a433-443d-a112-d1e03d7df84b/settings.json b/src/4815e1c7-a433-443d-a112-d1e03d7df84b/settings.json index 6b3b222..acbc654 100644 --- a/src/4815e1c7-a433-443d-a112-d1e03d7df84b/settings.json +++ b/src/4815e1c7-a433-443d-a112-d1e03d7df84b/settings.json @@ -1 +1,34 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "0", + "guid": "4815e1c7-a433-443d-a112-d1e03d7df84b", + "implements": [ + "-1" + ], + "load_selection": null, + "name": "Database", + "power_version": "1.0.0", + "system_name": "JCB.Service.Database", + "type": "class", + "use_selection": { + "use_selection0": { + "use": "06f8eada-d59b-441c-b287-0aea1793da5a", + "as": "default" + }, + "use_selection1": { + "use": "524eb8f6-38d4-47dc-92ad-98b94e099ac0", + "as": "default" + }, + "use_selection2": { + "use": "cce56585-58b0-4f72-a92c-e2635ea52d83", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Componentbuilder.Service.Database", + "description": "Database Service Provider\r\n\r\n@since 3.2.0", + "implements_custom": "ServiceProviderInterface", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;", + "composer": "" +} \ No newline at end of file diff --git a/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/README.md b/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/README.md index 433b69e..27525f7 100644 --- a/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/README.md +++ b/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/README.md @@ -1 +1,51 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class JsonHelper (Details) +> namespace: **VDM\Joomla\Utilities** +```uml +@startuml +abstract JsonHelper #Orange { + + {static} check($string) : bool + + {static} string($value, $separator = ", ...) +} + +note right of JsonHelper::check + Check if you have a json string + + since: 3.0.9 + return: bool +end note + +note right of JsonHelper::string + Convert a json object to a string + + since: 3.0.9 + + arguments: + $value + $separator = " + $table = null + $id = 'id' + $name = 'name' +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.php b/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.php index b9a864e..47fbd24 100644 --- a/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.php +++ b/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.php @@ -9,4 +9,93 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities; + + +/** + * The json checker + * + * @since 3.0.9 + */ +abstract class JsonHelper +{ + /** + * Check if you have a json string + * + * @input string $string The json string to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($string): bool + { + if (StringHelper::check($string)) + { + json_decode((string) $string); + return (json_last_error() === JSON_ERROR_NONE); + } + + return false; + } + + /** + * Convert a json object to a string + * + * @input string $value The json string to convert + * + * @returns a string + * + * @since 3.0.9 + */ + public static function string($value, $separator = ", ", $table = null, $id = 'id', $name = 'name') + { + // do some table foot work + $external = false; + if (is_string($table) && strpos((string) $table, '#__') !== false) + { + $external = true; + $table = str_replace('#__', '', (string) $table); + } + + // check if string is JSON + $result = json_decode((string) $value, true); + if (json_last_error() === JSON_ERROR_NONE) + { + // is JSON + if (ArrayHelper::check($result)) + { + if (StringHelper::check($table)) + { + $names = []; + foreach ($result as $val) + { + if ($external) + { + if ($_name = GetHelper::var(null, $val, $id, $name, '=', $table)) + { + $names[] = $_name; + } + } + else + { + if ($_name = GetHelper::var($table, $val, $id, $name)) + { + $names[] = $_name; + } + } + } + if (ArrayHelper::check($names)) + { + return (string) implode($separator, $names); + } + } + return (string) implode($separator, $result); + } + return (string) json_decode((string) $value); + } + return $value; + } + +} + diff --git a/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.power b/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.power index 69309b0..3053e99 100644 --- a/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.power +++ b/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.power @@ -1 +1,77 @@ -###CODEPOWER### \ No newline at end of file + /** + * Check if you have a json string + * + * @input string $string The json string to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($string): bool + { + if (StringHelper::check($string)) + { + json_decode((string) $string); + return (json_last_error() === JSON_ERROR_NONE); + } + + return false; + } + + /** + * Convert a json object to a string + * + * @input string $value The json string to convert + * + * @returns a string + * + * @since 3.0.9 + */ + public static function string($value, $separator = ", ", $table = null, $id = 'id', $name = 'name') + { + // do some table foot work + $external = false; + if (is_string($table) && strpos((string) $table, '#__') !== false) + { + $external = true; + $table = str_replace('#__', '', (string) $table); + } + + // check if string is JSON + $result = json_decode((string) $value, true); + if (json_last_error() === JSON_ERROR_NONE) + { + // is JSON + if (ArrayHelper::check($result)) + { + if (StringHelper::check($table)) + { + $names = []; + foreach ($result as $val) + { + if ($external) + { + if ($_name = GetHelper::var(null, $val, $id, $name, '=', $table)) + { + $names[] = $_name; + } + } + else + { + if ($_name = GetHelper::var($table, $val, $id, $name)) + { + $names[] = $_name; + } + } + } + if (ArrayHelper::check($names)) + { + return (string) implode($separator, $names); + } + } + return (string) implode($separator, $result); + } + return (string) json_decode((string) $value); + } + return $value; + } diff --git a/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/settings.json b/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/settings.json index 6b3b222..be43cde 100644 --- a/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/settings.json +++ b/src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/settings.json @@ -1 +1,28 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "4b225c51-d293-48e4-b3f6-5136cf5c3f18", + "implements": null, + "load_selection": { + "load_selection0": { + "load": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef" + }, + "load_selection1": { + "load": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a" + }, + "load_selection2": { + "load": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc" + } + }, + "name": "JsonHelper", + "power_version": "1.0.0", + "system_name": "Utilities Json Helper", + "type": "abstract class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Utilities.JsonHelper", + "description": "The json checker\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/README.md b/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/README.md index 433b69e..03957a0 100644 --- a/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/README.md +++ b/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/README.md @@ -1 +1,111 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Insert (Details) +> namespace: **VDM\Joomla\Database** +> extends: **Database** +```uml +@startuml +class Insert << (F,LightGreen) >> #RoyalBlue { + # bool $defaults + + defaults(bool $trigger = true) : void + + rows(array $data, string $table, ...) : bool + + items(array $data, string $table, ...) : bool + + row(array $data, string $table) : bool + + item(object $data, string $table) : bool + # getArrayColumns(array $data) : array + # getObjectsColumns(array $data) : array + # insert(array $data, string $table, ...) : bool +} + +note right of Insert::defaults + Switch to prevent/allow defaults from being added. + + since: 3.2.0 + return: void +end note + +note left of Insert::rows + Insert rows to the database (with remapping and filtering columns option) + + since: 3.2.0 + return: bool + + arguments: + array $data + string $table + array $columns = [] +end note + +note right of Insert::items + Insert items to the database (with remapping and filtering columns option) + + since: 3.2.0 + return: bool + + arguments: + array $data + string $table + array $columns = [] +end note + +note left of Insert::row + Insert row to the database + + since: 3.2.0 + return: bool +end note + +note right of Insert::item + Insert item to the database + + since: 3.2.0 + return: bool +end note + +note left of Insert::getArrayColumns + Get columns from data array + + since: 3.2.0 + return: array +end note + +note right of Insert::getObjectsColumns + Get columns from data objects + + since: 3.2.0 + return: array +end note + +note left of Insert::insert + Insert data into the database + + since: 3.2.0 + return: bool + + arguments: + array $data + string $table + array $columns + bool $isArray +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/code.php b/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/code.php index 26c1a50..bf7611a 100644 --- a/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/code.php +++ b/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/code.php @@ -9,4 +9,282 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Database; + + +use Joomla\CMS\Date\Date; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Interfaces\InsertInterface; +use VDM\Joomla\Abstraction\Database; + + +/** + * Database Insert Class + * + * @since 3.2.0 + */ +final class Insert extends Database implements InsertInterface +{ + /** + * Switch to set the defaults + * + * @var bool + * @since 1.2.0 + **/ + protected bool $defaults = true; + + /** + * Switch to prevent/allow defaults from being added. + * + * @param bool $trigger toggle the defaults + * + * @return void + * @since 3.2.0 + **/ + public function defaults(bool $trigger = true) + { + $this->defaults = $trigger; + } + + /** + * Insert rows to the database (with remapping and filtering columns option) + * + * @param array $data Dataset to store in database [array of arrays (key => value)] + * @param string $table The table where the data is being added + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function rows(array $data, string $table, array $columns = []): bool + { + if (!ArrayHelper::check($data)) + { + return false; + } + + if ($columns === []) + { + $columns = $this->getArrayColumns($data); + } + + return ($columns === []) ? false : $this->insert($data, $table, $columns, true); + } + + /** + * Insert items to the database (with remapping and filtering columns option) + * + * @param array $data Data to store in database (array of objects) + * @param string $table The table where the data is being added + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function items(array $data, string $table, array $columns = []): bool + { + if (!ArrayHelper::check($data)) + { + return false; + } + + if ($columns === []) + { + $columns = $this->getObjectsColumns($data); + } + + return ($columns === []) ? false : $this->insert($data, $table, $columns, false); + } + + /** + * Insert row to the database + * + * @param array $data Dataset to store in database (key => value) + * @param string $table The table where the data is being added + * + * @return bool + * @since 3.2.0 + **/ + public function row(array $data, string $table): bool + { + return $this->rows([$data], $table); + } + + /** + * Insert item to the database + * + * @param object $data Dataset to store in database (key => value) + * @param string $table The table where the data is being added + * + * @return bool + * @since 3.2.0 + **/ + public function item(object $data, string $table): bool + { + return $this->items([$data], $table); + } + + /** + * Get columns from data array + * + * @param array $data Data array + * + * @return array + * @since 3.2.0 + **/ + protected function getArrayColumns(array &$data): array + { + $row = array_values($data)[0]; + + if (!ArrayHelper::check($row)) + { + return []; + } + + $columns = array_keys($row); + + return array_combine($columns, $columns); + } + + /** + * Get columns from data objects + * + * @param array $data Data objects + * + * @return array + * @since 3.2.0 + **/ + protected function getObjectsColumns(array &$data): array + { + $row = array_values($data)[0]; + + if (!is_object($row)) + { + return []; + } + + $columns = get_object_vars($row); + + return array_combine(array_keys($columns), array_keys($columns)); + } + + /** + * Insert data into the database + * + * @param array $data Data to store in database + * @param string $table The table where the data is being added + * @param array $columns Data columns for remapping and filtering + * @param bool $isArray Whether the data is an array of arrays or an array of objects + * + * @return bool + * @since 3.2.0 + **/ + protected function insert(array &$data, string $table, array $columns, bool $isArray): bool + { + // set joomla default columns + $add_created = false; + $add_version = false; + $add_published = false; + + // check if we should load the defaults + if ($this->defaults) + { + // get the date + $date = (new Date())->toSql(); + + if (!isset($columns['created'])) + { + $columns['created'] = ' (o_O) '; + $add_created = true; + } + + if (!isset($columns['version'])) + { + $columns['version'] = ' (o_O) '; + $add_version = true; + } + + if (!isset($columns['published'])) + { + $columns['published'] = ' (o_O) '; + $add_published = true; + } + // the (o_O) prevents an empty value from being loaded + } + + // get a query object + $query = $this->db->getQuery(true); + + // set the query targets + $query->insert($this->db->quoteName($this->getTable($table)))->columns($this->db->quoteName(array_keys($columns))); + + // limiting factor on the amount of rows to insert before we reset the query + $limit = 300; + + // set the insert values + foreach ($data as $nr => $value) + { + // check the limit + if ($limit <= 1) + { + // execute and reset the query + $this->db->setQuery($query); + $this->db->execute(); + + // reset limit + $limit = 300; + + // get a query object + $query = $this->db->getQuery(true); + + // set the query targets + $query->insert($this->db->quoteName($this->getTable($table)))->columns($this->db->quoteName(array_keys($columns))); + } + + $row = []; + foreach ($columns as $column => $key) + { + if (' (o_O) ' !== $key) + { + $row[] = ($isArray && isset($value[$key])) ? $this->quote($value[$key]) + : ((!$isArray && isset($value->{$key})) ? $this->quote($value->{$key}) : ''); + } + } + + // set joomla default columns + if ($add_created) + { + $row[] = $this->db->quote($date); + } + + if ($add_version) + { + $row[] = 1; + } + + if ($add_published) + { + $row[] = 1; + } + + // add to query + $query->values(implode(',', $row)); + + // decrement the limiter + $limit--; + + // clear the data from memory + unset($data[$nr]); + } + + // execute the final query + $this->db->setQuery($query); + $this->db->execute(); + + // always reset the default switch + $this->defaults(); + + return true; + } +} + diff --git a/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/code.power b/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/code.power index 69309b0..a3f4acf 100644 --- a/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/code.power +++ b/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/code.power @@ -1 +1,261 @@ -###CODEPOWER### \ No newline at end of file + /** + * Switch to set the defaults + * + * @var bool + * @since 1.2.0 + **/ + protected bool $defaults = true; + + /** + * Switch to prevent/allow defaults from being added. + * + * @param bool $trigger toggle the defaults + * + * @return void + * @since 3.2.0 + **/ + public function defaults(bool $trigger = true) + { + $this->defaults = $trigger; + } + + /** + * Insert rows to the database (with remapping and filtering columns option) + * + * @param array $data Dataset to store in database [array of arrays (key => value)] + * @param string $table The table where the data is being added + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function rows(array $data, string $table, array $columns = []): bool + { + if (!ArrayHelper::check($data)) + { + return false; + } + + if ($columns === []) + { + $columns = $this->getArrayColumns($data); + } + + return ($columns === []) ? false : $this->insert($data, $table, $columns, true); + } + + /** + * Insert items to the database (with remapping and filtering columns option) + * + * @param array $data Data to store in database (array of objects) + * @param string $table The table where the data is being added + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function items(array $data, string $table, array $columns = []): bool + { + if (!ArrayHelper::check($data)) + { + return false; + } + + if ($columns === []) + { + $columns = $this->getObjectsColumns($data); + } + + return ($columns === []) ? false : $this->insert($data, $table, $columns, false); + } + + /** + * Insert row to the database + * + * @param array $data Dataset to store in database (key => value) + * @param string $table The table where the data is being added + * + * @return bool + * @since 3.2.0 + **/ + public function row(array $data, string $table): bool + { + return $this->rows([$data], $table); + } + + /** + * Insert item to the database + * + * @param object $data Dataset to store in database (key => value) + * @param string $table The table where the data is being added + * + * @return bool + * @since 3.2.0 + **/ + public function item(object $data, string $table): bool + { + return $this->items([$data], $table); + } + + /** + * Get columns from data array + * + * @param array $data Data array + * + * @return array + * @since 3.2.0 + **/ + protected function getArrayColumns(array &$data): array + { + $row = array_values($data)[0]; + + if (!ArrayHelper::check($row)) + { + return []; + } + + $columns = array_keys($row); + + return array_combine($columns, $columns); + } + + /** + * Get columns from data objects + * + * @param array $data Data objects + * + * @return array + * @since 3.2.0 + **/ + protected function getObjectsColumns(array &$data): array + { + $row = array_values($data)[0]; + + if (!is_object($row)) + { + return []; + } + + $columns = get_object_vars($row); + + return array_combine(array_keys($columns), array_keys($columns)); + } + + /** + * Insert data into the database + * + * @param array $data Data to store in database + * @param string $table The table where the data is being added + * @param array $columns Data columns for remapping and filtering + * @param bool $isArray Whether the data is an array of arrays or an array of objects + * + * @return bool + * @since 3.2.0 + **/ + protected function insert(array &$data, string $table, array $columns, bool $isArray): bool + { + // set joomla default columns + $add_created = false; + $add_version = false; + $add_published = false; + + // check if we should load the defaults + if ($this->defaults) + { + // get the date + $date = (new Date())->toSql(); + + if (!isset($columns['created'])) + { + $columns['created'] = ' (o_O) '; + $add_created = true; + } + + if (!isset($columns['version'])) + { + $columns['version'] = ' (o_O) '; + $add_version = true; + } + + if (!isset($columns['published'])) + { + $columns['published'] = ' (o_O) '; + $add_published = true; + } + // the (o_O) prevents an empty value from being loaded + } + + // get a query object + $query = $this->db->getQuery(true); + + // set the query targets + $query->insert($this->db->quoteName($this->getTable($table)))->columns($this->db->quoteName(array_keys($columns))); + + // limiting factor on the amount of rows to insert before we reset the query + $limit = 300; + + // set the insert values + foreach ($data as $nr => $value) + { + // check the limit + if ($limit <= 1) + { + // execute and reset the query + $this->db->setQuery($query); + $this->db->execute(); + + // reset limit + $limit = 300; + + // get a query object + $query = $this->db->getQuery(true); + + // set the query targets + $query->insert($this->db->quoteName($this->getTable($table)))->columns($this->db->quoteName(array_keys($columns))); + } + + $row = []; + foreach ($columns as $column => $key) + { + if (' (o_O) ' !== $key) + { + $row[] = ($isArray && isset($value[$key])) ? $this->quote($value[$key]) + : ((!$isArray && isset($value->{$key})) ? $this->quote($value->{$key}) : ''); + } + } + + // set joomla default columns + if ($add_created) + { + $row[] = $this->db->quote($date); + } + + if ($add_version) + { + $row[] = 1; + } + + if ($add_published) + { + $row[] = 1; + } + + // add to query + $query->values(implode(',', $row)); + + // decrement the limiter + $limit--; + + // clear the data from memory + unset($data[$nr]); + } + + // execute the final query + $this->db->setQuery($query); + $this->db->execute(); + + // always reset the default switch + $this->defaults(); + + return true; + } \ No newline at end of file diff --git a/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/settings.json b/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/settings.json index 6b3b222..42aa1ba 100644 --- a/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/settings.json +++ b/src/524eb8f6-38d4-47dc-92ad-98b94e099ac0/settings.json @@ -1 +1,25 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "6cbef8f8-4813-48e3-b05a-65e1aea95171", + "guid": "524eb8f6-38d4-47dc-92ad-98b94e099ac0", + "implements": [ + "ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48" + ], + "load_selection": null, + "name": "Insert", + "power_version": "1.0.0", + "system_name": "VDM.Database.Insert", + "type": "final class", + "use_selection": { + "use_selection0": { + "use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Database.Insert", + "description": "Database Insert Class\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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\\CMS\\Date\\Date;", + "composer": "" +} \ No newline at end of file diff --git a/src/52a1d14f-304a-431c-8fa4-411179942db5/README.md b/src/52a1d14f-304a-431c-8fa4-411179942db5/README.md index 433b69e..0cbdec8 100644 --- a/src/52a1d14f-304a-431c-8fa4-411179942db5/README.md +++ b/src/52a1d14f-304a-431c-8fa4-411179942db5/README.md @@ -1 +1,46 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# trait VarExport (Details) +> namespace: **VDM\Joomla\Abstraction\Registry\Traits** +```uml +@startuml +class VarExport << (T,Orange) >> #Turquoise { + # int $indent + + varExport(?string $path = null, int $indentation = 2) : ?string + # convertIndent(array $matches) : string +} + +note right of VarExport::varExport + Method to export a set of values to a PHP array + + since: 3.4.0 + return: ?string +end note + +note right of VarExport::convertIndent + Method to convert found of grouped spaces to system indentation + + since: 3.4.0 + return: string +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/52a1d14f-304a-431c-8fa4-411179942db5/code.php b/src/52a1d14f-304a-431c-8fa4-411179942db5/code.php index 26c1a50..56af57e 100644 --- a/src/52a1d14f-304a-431c-8fa4-411179942db5/code.php +++ b/src/52a1d14f-304a-431c-8fa4-411179942db5/code.php @@ -9,4 +9,97 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction\Registry\Traits; + + +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; + + +/** + * Var Export Values + * + * @since 3.2.0 + */ +trait VarExport +{ + /** + * Default indentation value + * + * @var int + * @since 3.4.0 + */ + protected int $indent = 2; + + /** + * Method to export a set of values to a PHP array + * + * @param string|null $path Registry path (e.g. joomla.content.showauthor) + * @param int $indentation The default indentation + * + * @return ?string The var set being exported as a PHP array + * @since 3.4.0 + */ + public function varExport(?string $path = null, int $indentation = 2): ?string + { + // Load the data array + if ($path === null && $this->isActive()) + { + $data = $this->allActive(); + } + else + { + $data = $this->get($path); + } + + // check if we have data + if ($data === null) + { + return null; + } + + // set the default indentation value + $this->indent = $indentation; + + // convert to string + $data = var_export($data, true); + + // replace all space with system indentation + $data = preg_replace_callback("/^(\s{2})(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(.*)/m", [$this, 'convertIndent'], $data); + + // convert all array to [] + $array = preg_split("/\r\n|\n|\r/", $data); + $array = preg_replace(["/\s*array\s\($/", "/\)(,)?$/", "/\s=>\s$/"], [NULL, ']$1', ' => ['], $array); + $data = implode(PHP_EOL, array_filter(["["] + $array)); + + // add needed indentation to the last ] + $data = preg_replace("/^(\])/m", Indent::_($indentation) . '$1', $data); + + return $data; + } + + /** + * Method to convert found of grouped spaces to system indentation + * + * @param array $matches The regex array of matching values + * + * @return string The resulting string. + * @since 3.4.0 + */ + protected function convertIndent(array $matches): string + { + // set number to indent by default + $indent = Indent::_($this->indent); + + // update each found space (group) with one indentation + foreach (range(1, 11) as $space) + { + if (strlen((string) $matches[$space]) > 0) + { + $indent .= Indent::_(1); + } + } + + return $indent . $matches[12]; + } +} + diff --git a/src/52a1d14f-304a-431c-8fa4-411179942db5/code.power b/src/52a1d14f-304a-431c-8fa4-411179942db5/code.power index 69309b0..6677e5f 100644 --- a/src/52a1d14f-304a-431c-8fa4-411179942db5/code.power +++ b/src/52a1d14f-304a-431c-8fa4-411179942db5/code.power @@ -1 +1,79 @@ -###CODEPOWER### \ No newline at end of file + /** + * Default indentation value + * + * @var int + * @since 3.4.0 + */ + protected int $indent = 2; + + /** + * Method to export a set of values to a PHP array + * + * @param string|null $path Registry path (e.g. joomla.content.showauthor) + * @param int $indentation The default indentation + * + * @return ?string The var set being exported as a PHP array + * @since 3.4.0 + */ + public function varExport(?string $path = null, int $indentation = 2): ?string + { + // Load the data array + if ($path === null && $this->isActive()) + { + $data = $this->allActive(); + } + else + { + $data = $this->get($path); + } + + // check if we have data + if ($data === null) + { + return null; + } + + // set the default indentation value + $this->indent = $indentation; + + // convert to string + $data = var_export($data, true); + + // replace all space with system indentation + $data = preg_replace_callback("/^(\s{2})(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(.*)/m", [$this, 'convertIndent'], $data); + + // convert all array to [] + $array = preg_split("/\r\n|\n|\r/", $data); + $array = preg_replace(["/\s*array\s\($/", "/\)(,)?$/", "/\s=>\s$/"], [NULL, ']$1', ' => ['], $array); + $data = implode(PHP_EOL, array_filter(["["] + $array)); + + // add needed indentation to the last ] + $data = preg_replace("/^(\])/m", Indent::_($indentation) . '$1', $data); + + return $data; + } + + /** + * Method to convert found of grouped spaces to system indentation + * + * @param array $matches The regex array of matching values + * + * @return string The resulting string. + * @since 3.4.0 + */ + protected function convertIndent(array $matches): string + { + // set number to indent by default + $indent = Indent::_($this->indent); + + // update each found space (group) with one indentation + foreach (range(1, 11) as $space) + { + if (strlen((string) $matches[$space]) > 0) + { + $indent .= Indent::_(1); + } + } + + return $indent . $matches[12]; + } \ No newline at end of file diff --git a/src/52a1d14f-304a-431c-8fa4-411179942db5/settings.json b/src/52a1d14f-304a-431c-8fa4-411179942db5/settings.json index 6b3b222..bac5c4a 100644 --- a/src/52a1d14f-304a-431c-8fa4-411179942db5/settings.json +++ b/src/52a1d14f-304a-431c-8fa4-411179942db5/settings.json @@ -1 +1,23 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "52a1d14f-304a-431c-8fa4-411179942db5", + "implements": null, + "load_selection": null, + "name": "VarExport", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.Registry.Traits.VarExport", + "type": "trait", + "use_selection": { + "use_selection0": { + "use": "a68c010b-e92e-47d5-8a44-d23cfddeb6c6", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Abstraction.Registry.Traits.VarExport", + "description": "Var Export Values\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/584747d1-3a86-453d-b7a3-a2219de8d777/README.md b/src/584747d1-3a86-453d-b7a3-a2219de8d777/README.md index 433b69e..77a2b0a 100644 --- a/src/584747d1-3a86-453d-b7a3-a2219de8d777/README.md +++ b/src/584747d1-3a86-453d-b7a3-a2219de8d777/README.md @@ -1 +1,139 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class Model (Details) +> namespace: **VDM\Joomla\Abstraction** +```uml +@startuml +abstract Model #Orange { + # array $last + # Table $table + + __construct(Table $table) + + {abstract} value(mixed $value, string $field, ...) : mixed + + item(?object $item, ?string $table = null) : ?object + + items(?array $items = null, ?string $table = null) : ?array + + row(?array $item, ?string $table = null) : ?array + + rows(?array $items = null, ?string $table = null) : ?array + + last(?string $table = null) : ?int + # getTableFields(string $table, bool $default = false) : ?array + # {abstract} validateBefore(mixed $value, ?string $field = null, ...) : bool + # {abstract} validateAfter(mixed $value, ?string $field = null, ...) : bool + # {abstract} getTable() : string +} + +note right of Model::__construct + Constructor + + since: 3.2.0 +end note + +note left of Model::value + Model the value +Example: $this->value(value, 'value_key', 'table_name'); + + since: 3.2.0 + return: mixed + + arguments: + mixed $value + string $field + ?string $table = null +end note + +note right of Model::item + Model the values of an item +Example: $this->item(Object, 'table_name'); + + since: 3.2.0 + return: ?object +end note + +note left of Model::items + Model the values of multiple items +Example: $this->items(Array, 'table_name'); + + since: 3.2.0 + return: ?array +end note + +note right of Model::row + Model the values of an row +Example: $this->item(Array, 'table_name'); + + since: 3.2.0 + return: ?array +end note + +note left of Model::rows + Model the values of multiple rows +Example: $this->items(Array, 'table_name'); + + since: 3.2.0 + return: ?array +end note + +note right of Model::last + Get last modeled ID +Example: $this->last('table_name'); + + since: 3.2.0 + return: ?int +end note + +note left of Model::getTableFields + Get the current active table's fields (including defaults) + + since: 3.2.0 + return: ?array +end note + +note right of Model::validateBefore + Validate before the value is modelled (basic, override in child class) + + since: 3.2.0 + return: bool + + arguments: + mixed $value + ?string $field = null + ?string $table = null +end note + +note left of Model::validateAfter + Validate after the value is modelled (basic, override in child class) + + since: 3.2.0 + return: bool + + arguments: + mixed $value + ?string $field = null + ?string $table = null +end note + +note right of Model::getTable + Get the current active table + + since: 3.2.0 + return: string +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/584747d1-3a86-453d-b7a3-a2219de8d777/code.php b/src/584747d1-3a86-453d-b7a3-a2219de8d777/code.php index 26c1a50..9321eef 100644 --- a/src/584747d1-3a86-453d-b7a3-a2219de8d777/code.php +++ b/src/584747d1-3a86-453d-b7a3-a2219de8d777/code.php @@ -9,4 +9,350 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction; + + +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Interfaces\Tableinterface as Table; + + +/** + * Base Model + * + * @since 3.2.0 + */ +abstract class Model +{ + /** + * Last ID + * + * @var array + * @since 3.2.0 + */ + protected array $last; + + /** + * Search Table + * + * @var Table + * @since 3.2.0 + */ + protected Table $table; + + /** + * Constructor + * + * @param Table $table The search table object. + * + * @since 3.2.0 + */ + public function __construct(Table $table) + { + $this->table = $table; + } + + /** + * Model the value + * Example: $this->value(value, 'value_key', 'table_name'); + * + * @param mixed $value The value to model + * @param string $field The field key + * @param string|null $table The table + * + * @return mixed + * @since 3.2.0 + */ + abstract public function value($value, string $field, ?string $table = null); + + /** + * Model the values of an item + * Example: $this->item(Object, 'table_name'); + * + * @param object|null $item The item object + * @param string|null $table The table + * + * @return object|null + * @since 3.2.0 + */ + public function item(?object $item, ?string $table = null): ?object + { + // we must have an object + if (empty($item)) + { + return null; + } + + // set the table name + if (empty($table)) + { + $table = $this->getTable(); + } + + if (($fields = $this->getTableFields($table, true)) !== null) + { + // field counter + $field_number = 0; + + // check if this is a valid table + $item_bucket = new \stdClass(); + + foreach ($fields as $field) + { + // model a value if it exists + if(isset($item->{$field})) + { + if (!$this->validateBefore($item->{$field}, $field, $table)) + { + continue; + } + + $item->{$field} = $this->value($item->{$field}, $field, $table); + + if (!$this->validateAfter($item->{$field}, $field, $table)) + { + continue; + } + + $item_bucket->{$field} = $item->{$field}; + + $field_number++; + } + } + + // all items must have more than one field or its empty (1 = key) + if ($field_number > 1) + { + return $item_bucket; + } + } + + return null; + } + + /** + * Model the values of multiple items + * Example: $this->items(Array, 'table_name'); + * + * @param array|null $items The array of item objects + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function items(?array $items = null, ?string $table = null): ?array + { + // check if this is a valid table + if (ArrayHelper::check($items)) + { + // set the table name + if (empty($table)) + { + $table = $this->getTable(); + } + + foreach ($items as $id => &$item) + { + // model the item + if (($item = $this->item($item, $table)) !== null) + { + // add the last ID + $this->last[$table] = $item->id ?? $this->last[$table] ?? null; + } + else + { + unset($items[$id]); + } + } + + if (ArrayHelper::check($items)) + { + return $items; + } + } + + return null; + } + + /** + * Model the values of an row + * Example: $this->item(Array, 'table_name'); + * + * @param array|null $item The item array + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function row(?array $item, ?string $table = null): ?array + { + // we must have an array + if (empty($item)) + { + return null; + } + + // set the table name + if (empty($table)) + { + $table = $this->getTable(); + } + + if (($fields = $this->getTableFields($table, true)) !== null) + { + // field counter + $field_number = 0; + + // check if this is a valid table + $item_bucket = []; + + foreach ($fields as $field) + { + // model a value if it exists + if(isset($item[$field])) + { + if (!$this->validateBefore($item[$field], $field, $table)) + { + continue; + } + + $item[$field] = $this->value($item[$field], $field, $table); + + if (!$this->validateAfter($item[$field], $field, $table)) + { + continue; + } + + $item_bucket[$field] = $item[$field]; + + $field_number++; + } + } + + // all items must have more than one field or its empty (1 = id or guid) + if ($field_number > 1) + { + return $item_bucket; + } + } + + return null; + } + + /** + * Model the values of multiple rows + * Example: $this->items(Array, 'table_name'); + * + * @param array|null $items The array of item array + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function rows(?array $items = null, ?string $table = null): ?array + { + // check if this is a valid table + if (ArrayHelper::check($items)) + { + // set the table name + if (empty($table)) + { + $table = $this->getTable(); + } + + foreach ($items as $id => &$item) + { + // model the item + if (($item = $this->row($item, $table)) !== null) + { + // add the last ID + $this->last[$table] = $item['id'] ?? $this->last[$table] ?? null; + } + else + { + unset($items[$id]); + } + } + + if (ArrayHelper::check($items)) + { + return $items; + } + } + + return null; + } + + /** + * Get last modeled ID + * Example: $this->last('table_name'); + * + * @param string|null $table The table + * + * @return int|null + * @since 3.2.0 + */ + public function last(?string $table = null): ?int + { + // set the table name + if (empty($table)) + { + $table = $this->getTable(); + } + + // check if this is a valid table + if ($table && isset($this->last[$table])) + { + return $this->last[$table]; + } + + return null; + } + + /** + * Get the current active table's fields (including defaults) + * + * @param string $table The area + * @param bool $default Add the default fields + * + * @return array + * @since 3.2.0 + */ + protected function getTableFields(string $table, bool $default = false): ?array + { + return $this->table->fields($table, $default); + } + + /** + * Validate before the value is modelled (basic, override in child class) + * + * @param mixed $value The field value + * @param string|null $field The field key + * @param string|null $table The table + * + * @return bool + * @since 3.2.0 + */ + abstract protected function validateBefore(&$value, ?string $field = null, ?string $table = null): bool; + + /** + * Validate after the value is modelled (basic, override in child class) + * + * @param mixed $value The field value + * @param string|null $field The field key + * @param string|null $table The table + * + * @return bool + * @since 3.2.0 + */ + abstract protected function validateAfter(&$value, ?string $field = null, ?string $table = null): bool; + + /** + * Get the current active table + * + * @return string + * @since 3.2.0 + */ + abstract protected function getTable(): string; +} + diff --git a/src/584747d1-3a86-453d-b7a3-a2219de8d777/code.power b/src/584747d1-3a86-453d-b7a3-a2219de8d777/code.power index 69309b0..ad41542 100644 --- a/src/584747d1-3a86-453d-b7a3-a2219de8d777/code.power +++ b/src/584747d1-3a86-453d-b7a3-a2219de8d777/code.power @@ -1 +1,330 @@ -###CODEPOWER### \ No newline at end of file + /** + * Last ID + * + * @var array + * @since 3.2.0 + */ + protected array $last; + + /** + * Search Table + * + * @var Table + * @since 3.2.0 + */ + protected Table $table; + + /** + * Constructor + * + * @param Table $table The search table object. + * + * @since 3.2.0 + */ + public function __construct(Table $table) + { + $this->table = $table; + } + + /** + * Model the value + * Example: $this->value(value, 'value_key', 'table_name'); + * + * @param mixed $value The value to model + * @param string $field The field key + * @param string|null $table The table + * + * @return mixed + * @since 3.2.0 + */ + abstract public function value($value, string $field, ?string $table = null); + + /** + * Model the values of an item + * Example: $this->item(Object, 'table_name'); + * + * @param object|null $item The item object + * @param string|null $table The table + * + * @return object|null + * @since 3.2.0 + */ + public function item(?object $item, ?string $table = null): ?object + { + // we must have an object + if (empty($item)) + { + return null; + } + + // set the table name + if (empty($table)) + { + $table = $this->getTable(); + } + + if (($fields = $this->getTableFields($table, true)) !== null) + { + // field counter + $field_number = 0; + + // check if this is a valid table + $item_bucket = new \stdClass(); + + foreach ($fields as $field) + { + // model a value if it exists + if(isset($item->{$field})) + { + if (!$this->validateBefore($item->{$field}, $field, $table)) + { + continue; + } + + $item->{$field} = $this->value($item->{$field}, $field, $table); + + if (!$this->validateAfter($item->{$field}, $field, $table)) + { + continue; + } + + $item_bucket->{$field} = $item->{$field}; + + $field_number++; + } + } + + // all items must have more than one field or its empty (1 = key) + if ($field_number > 1) + { + return $item_bucket; + } + } + + return null; + } + + /** + * Model the values of multiple items + * Example: $this->items(Array, 'table_name'); + * + * @param array|null $items The array of item objects + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function items(?array $items = null, ?string $table = null): ?array + { + // check if this is a valid table + if (ArrayHelper::check($items)) + { + // set the table name + if (empty($table)) + { + $table = $this->getTable(); + } + + foreach ($items as $id => &$item) + { + // model the item + if (($item = $this->item($item, $table)) !== null) + { + // add the last ID + $this->last[$table] = $item->id ?? $this->last[$table] ?? null; + } + else + { + unset($items[$id]); + } + } + + if (ArrayHelper::check($items)) + { + return $items; + } + } + + return null; + } + + /** + * Model the values of an row + * Example: $this->item(Array, 'table_name'); + * + * @param array|null $item The item array + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function row(?array $item, ?string $table = null): ?array + { + // we must have an array + if (empty($item)) + { + return null; + } + + // set the table name + if (empty($table)) + { + $table = $this->getTable(); + } + + if (($fields = $this->getTableFields($table, true)) !== null) + { + // field counter + $field_number = 0; + + // check if this is a valid table + $item_bucket = []; + + foreach ($fields as $field) + { + // model a value if it exists + if(isset($item[$field])) + { + if (!$this->validateBefore($item[$field], $field, $table)) + { + continue; + } + + $item[$field] = $this->value($item[$field], $field, $table); + + if (!$this->validateAfter($item[$field], $field, $table)) + { + continue; + } + + $item_bucket[$field] = $item[$field]; + + $field_number++; + } + } + + // all items must have more than one field or its empty (1 = id or guid) + if ($field_number > 1) + { + return $item_bucket; + } + } + + return null; + } + + /** + * Model the values of multiple rows + * Example: $this->items(Array, 'table_name'); + * + * @param array|null $items The array of item array + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function rows(?array $items = null, ?string $table = null): ?array + { + // check if this is a valid table + if (ArrayHelper::check($items)) + { + // set the table name + if (empty($table)) + { + $table = $this->getTable(); + } + + foreach ($items as $id => &$item) + { + // model the item + if (($item = $this->row($item, $table)) !== null) + { + // add the last ID + $this->last[$table] = $item['id'] ?? $this->last[$table] ?? null; + } + else + { + unset($items[$id]); + } + } + + if (ArrayHelper::check($items)) + { + return $items; + } + } + + return null; + } + + /** + * Get last modeled ID + * Example: $this->last('table_name'); + * + * @param string|null $table The table + * + * @return int|null + * @since 3.2.0 + */ + public function last(?string $table = null): ?int + { + // set the table name + if (empty($table)) + { + $table = $this->getTable(); + } + + // check if this is a valid table + if ($table && isset($this->last[$table])) + { + return $this->last[$table]; + } + + return null; + } + + /** + * Get the current active table's fields (including defaults) + * + * @param string $table The area + * @param bool $default Add the default fields + * + * @return array + * @since 3.2.0 + */ + protected function getTableFields(string $table, bool $default = false): ?array + { + return $this->table->fields($table, $default); + } + + /** + * Validate before the value is modelled (basic, override in child class) + * + * @param mixed $value The field value + * @param string|null $field The field key + * @param string|null $table The table + * + * @return bool + * @since 3.2.0 + */ + abstract protected function validateBefore(&$value, ?string $field = null, ?string $table = null): bool; + + /** + * Validate after the value is modelled (basic, override in child class) + * + * @param mixed $value The field value + * @param string|null $field The field key + * @param string|null $table The table + * + * @return bool + * @since 3.2.0 + */ + abstract protected function validateAfter(&$value, ?string $field = null, ?string $table = null): bool; + + /** + * Get the current active table + * + * @return string + * @since 3.2.0 + */ + abstract protected function getTable(): string; \ No newline at end of file diff --git a/src/584747d1-3a86-453d-b7a3-a2219de8d777/settings.json b/src/584747d1-3a86-453d-b7a3-a2219de8d777/settings.json index 6b3b222..39f7427 100644 --- a/src/584747d1-3a86-453d-b7a3-a2219de8d777/settings.json +++ b/src/584747d1-3a86-453d-b7a3-a2219de8d777/settings.json @@ -1 +1,31 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "584747d1-3a86-453d-b7a3-a2219de8d777", + "implements": null, + "load_selection": null, + "name": "Model", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.Model", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef", + "as": "default" + }, + "use_selection1": { + "use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a", + "as": "default" + }, + "use_selection2": { + "use": "2da6d6c4-eb29-4d69-8bc2-36d96e916adf", + "as": "Table" + } + }, + "namespace": "VDM\\Joomla\\Abstraction.Model", + "description": "Base Model\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/README.md b/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/README.md index 433b69e..be32765 100644 --- a/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/README.md +++ b/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/README.md @@ -1 +1,37 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# trait GetString (Details) +> namespace: **VDM\Joomla\Abstraction\Registry\Traits** +```uml +@startuml +class GetString << (T,Orange) >> #Turquoise { + + getString(string $path, ?string $default = null) : ?string +} + +note right of GetString::getString + Get a registry path if the return value is a string + + since: 3.2.0 + return: ?string +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.php b/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.php index 26c1a50..56f128d 100644 --- a/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.php +++ b/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.php @@ -9,4 +9,42 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction\Registry\Traits; + + +/** + * Get String Values + * + * @since 3.2.0 + */ +trait GetString +{ + /** + * Get a registry path if the return value is a string + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * @param string|null $default A default value + * + * @return string|null + * @since 3.2.0 + */ + public function getString(string $path, ?string $default = null): ?string + { + // Return default value if path is empty + if (empty($path)) + { + return $default; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_string($node) + && strlen((string) $node) > 0) + { + return $node; + } + + return $default; + } +} + diff --git a/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.power b/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.power index 69309b0..629eae8 100644 --- a/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.power +++ b/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.power @@ -1 +1,27 @@ -###CODEPOWER### \ No newline at end of file + /** + * Get a registry path if the return value is a string + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * @param string|null $default A default value + * + * @return string|null + * @since 3.2.0 + */ + public function getString(string $path, ?string $default = null): ?string + { + // Return default value if path is empty + if (empty($path)) + { + return $default; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_string($node) + && strlen((string) $node) > 0) + { + return $node; + } + + return $default; + } \ No newline at end of file diff --git a/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/settings.json b/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/settings.json index 6b3b222..4e54cf2 100644 --- a/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/settings.json +++ b/src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "59b1a2ea-d77e-4040-ac8c-e65cd8743e9b", + "implements": null, + "load_selection": null, + "name": "GetString", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.Registry.Traits.GetString", + "type": "trait", + "use_selection": null, + "namespace": "VDM\\Joomla\\Abstraction.Registry.Traits.GetString", + "description": "Get String Values\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/640b5352-fb09-425f-a26e-cd44eda03f15/README.md b/src/640b5352-fb09-425f-a26e-cd44eda03f15/README.md index 433b69e..fa891bb 100644 --- a/src/640b5352-fb09-425f-a26e-cd44eda03f15/README.md +++ b/src/640b5352-fb09-425f-a26e-cd44eda03f15/README.md @@ -1 +1,106 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class Helper (Details) +> namespace: **VDM\Joomla\Utilities\Component** +```uml +@startuml +abstract Helper #Orange { + + {static} getParams(?string $option = null) : Registry + + {static} setOption(?string $option) : void + + {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 +} + +note right of Helper::getParams + Gets the parameter object for the component + + since: 3.0.11 + return: Registry +end note + +note left of Helper::setOption + Set the component option + + since: 3.2.0 + return: void +end note + +note right of Helper::getOption + Get the component option + + since: 3.0.11 + return: ?string +end note + +note left of Helper::getCode + Gets the component code name + + since: 3.0.11 + return: ?string +end note + +note right of Helper::get + Gets the component abstract helper class + + since: 3.0.11 + return: ?string +end note + +note left of Helper::getNamespace + Gets the component namespace if set + + since: 3.0.11 + return: ?string +end note + +note right of Helper::getManifest + Gets the component abstract helper class + + since: 3.0.11 + return: ?object +end note + +note left of Helper::methodExists + Check if the helper class of this component has a method + + since: 3.0.11 + return: bool +end note + +note right of Helper::_ + Check if the helper class of this component has a method, and call it with the arguments + + since: 3.2.0 + return: mixed + + arguments: + string $method + array $arguments = [] + ?string $option = null +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/640b5352-fb09-425f-a26e-cd44eda03f15/code.php b/src/640b5352-fb09-425f-a26e-cd44eda03f15/code.php index b9a864e..5660a49 100644 --- a/src/640b5352-fb09-425f-a26e-cd44eda03f15/code.php +++ b/src/640b5352-fb09-425f-a26e-cd44eda03f15/code.php @@ -9,4 +9,288 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities\Component; + + +use Joomla\CMS\Factory; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\Input\Input; +use Joomla\Registry\Registry; +use VDM\Joomla\Utilities\String\NamespaceHelper; + + +/** + * Some component helper + * + * @since 3.0.11 + */ +abstract class Helper +{ + /** + * The current option + * + * @var string|null + * @since 3.0.11 + */ + 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 + * + * @var Registry[] + * @since 3.0.11 + */ + protected static array $params = []; + + /** + * Gets the parameter object for the component + * + * @param string|null $option The option for the component. + * + * @return Registry A Registry object. + * @see Registry + * @since 3.0.11 + */ + public static function getParams(?string $option = null): Registry + { + // check that we have an option + if (empty($option)) + { + $option = self::getOption(); + } + + // get global value + if (!isset(self::$params[$option]) || !self::$params[$option] instanceof Registry) + { + self::$params[$option] = ComponentHelper::getParams($option); + } + + return self::$params[$option]; + } + + /** + * Set the component option + * + * @param string|null $option The option + * + * @return void + * @since 3.2.0 + */ + public static function setOption(?string $option): void + { + self::$option = $option; + } + + /** + * Get the component option + * + * @param string|null $default The default return value if none is found + * + * @return string|null A component option + * @since 3.0.11 + */ + public static function getOption(?string $default = 'empty'): ?string + { + if (empty(self::$option)) + { + // get the option from the url input + self::$option = (new Input)->getString('option', null); + } + + if (empty(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 self::$option; + } + + /** + * Gets the component code name + * + * @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 code name + * @since 3.0.11 + */ + public static function getCode(?string $option = null, ?string $default = null): ?string + { + // check that we have an option + if (empty($option)) + { + $option = self::getOption(); + } + // option with com_ + if (is_string($option) && strpos($option, 'com_') === 0) + { + return strtolower(trim(substr($option, 4))); + } + + return $default; + } + + /** + * 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 string|null A component helper name + * + * @since 3.0.11 + */ + public static function get(?string $option = null, ?string $default = null): ?string + { + // check that we have an option + // and get the code name from it + 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 + * + * @param string $method The method name to search for + * @param string|null $option The option for the component. + * + * @return bool true if method exist + * + * @since 3.0.11 + */ + public static function methodExists(string $method, ?string $option = null): bool + { + // get the helper class + return ($helper = self::get($option, null)) !== null && + method_exists($helper, $method); + } + + /** + * Check if the helper class of this component has a method, and call it with the arguments + * + * @param string $method The method name to search for + * @param array $arguments The arguments for function. + * @param string|null $option The option for the component. + * + * @return mixed return whatever the method returns or null + * @since 3.2.0 + */ + public static function _(string $method, array $arguments = [], ?string $option = null) + { + // get the helper class + if (($helper = self::get($option, null)) !== null && + method_exists($helper, $method)) + { + // we know this is not ideal... + // so we need to move these + // functions to their own classes + return call_user_func_array([$helper, $method], $arguments); + } + + return null; + } + +} + diff --git a/src/640b5352-fb09-425f-a26e-cd44eda03f15/code.power b/src/640b5352-fb09-425f-a26e-cd44eda03f15/code.power index 69309b0..adc7052 100644 --- a/src/640b5352-fb09-425f-a26e-cd44eda03f15/code.power +++ b/src/640b5352-fb09-425f-a26e-cd44eda03f15/code.power @@ -1 +1,265 @@ -###CODEPOWER### \ No newline at end of file + /** + * The current option + * + * @var string|null + * @since 3.0.11 + */ + 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 + * + * @var Registry[] + * @since 3.0.11 + */ + protected static array $params = []; + + /** + * Gets the parameter object for the component + * + * @param string|null $option The option for the component. + * + * @return Registry A Registry object. + * @see Registry + * @since 3.0.11 + */ + public static function getParams(?string $option = null): Registry + { + // check that we have an option + if (empty($option)) + { + $option = self::getOption(); + } + + // get global value + if (!isset(self::$params[$option]) || !self::$params[$option] instanceof Registry) + { + self::$params[$option] = ComponentHelper::getParams($option); + } + + return self::$params[$option]; + } + + /** + * Set the component option + * + * @param string|null $option The option + * + * @return void + * @since 3.2.0 + */ + public static function setOption(?string $option): void + { + self::$option = $option; + } + + /** + * Get the component option + * + * @param string|null $default The default return value if none is found + * + * @return string|null A component option + * @since 3.0.11 + */ + public static function getOption(?string $default = 'empty'): ?string + { + if (empty(self::$option)) + { + // get the option from the url input + self::$option = (new Input)->getString('option', null); + } + + if (empty(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 self::$option; + } + + /** + * Gets the component code name + * + * @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 code name + * @since 3.0.11 + */ + public static function getCode(?string $option = null, ?string $default = null): ?string + { + // check that we have an option + if (empty($option)) + { + $option = self::getOption(); + } + // option with com_ + if (is_string($option) && strpos($option, 'com_') === 0) + { + return strtolower(trim(substr($option, 4))); + } + + return $default; + } + + /** + * 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 string|null A component helper name + * + * @since 3.0.11 + */ + public static function get(?string $option = null, ?string $default = null): ?string + { + // check that we have an option + // and get the code name from it + 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 + * + * @param string $method The method name to search for + * @param string|null $option The option for the component. + * + * @return bool true if method exist + * + * @since 3.0.11 + */ + public static function methodExists(string $method, ?string $option = null): bool + { + // get the helper class + return ($helper = self::get($option, null)) !== null && + method_exists($helper, $method); + } + + /** + * Check if the helper class of this component has a method, and call it with the arguments + * + * @param string $method The method name to search for + * @param array $arguments The arguments for function. + * @param string|null $option The option for the component. + * + * @return mixed return whatever the method returns or null + * @since 3.2.0 + */ + public static function _(string $method, array $arguments = [], ?string $option = null) + { + // get the helper class + if (($helper = self::get($option, null)) !== null && + method_exists($helper, $method)) + { + // we know this is not ideal... + // so we need to move these + // functions to their own classes + return call_user_func_array([$helper, $method], $arguments); + } + + return null; + } diff --git a/src/640b5352-fb09-425f-a26e-cd44eda03f15/settings.json b/src/640b5352-fb09-425f-a26e-cd44eda03f15/settings.json index 6b3b222..6f3faca 100644 --- a/src/640b5352-fb09-425f-a26e-cd44eda03f15/settings.json +++ b/src/640b5352-fb09-425f-a26e-cd44eda03f15/settings.json @@ -1 +1,23 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "0", + "guid": "640b5352-fb09-425f-a26e-cd44eda03f15", + "implements": null, + "load_selection": null, + "name": "Helper", + "power_version": "1.0.0", + "system_name": "Utilities Component Helper", + "type": "abstract class", + "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 \r\n * @git 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\\CMS\\Factory;\r\nuse Joomla\\CMS\\Component\\ComponentHelper;\r\nuse Joomla\\Input\\Input;\r\nuse Joomla\\Registry\\Registry;", + "composer": "" +} \ No newline at end of file diff --git a/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/README.md b/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/README.md index 433b69e..8cc3153 100644 --- a/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/README.md +++ b/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/README.md @@ -1 +1,42 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class Base64Helper (Details) +> namespace: **VDM\Joomla\Utilities** +```uml +@startuml +abstract Base64Helper #Orange { + + {static} open(?string $data, ?string $key = '__.o0=base64=Oo.__', ...) : ?string +} + +note right of Base64Helper::open + open base64 string if stored as base64 (in JCB) + + since: 3.2.0 + return: ?string + + arguments: + ?string $data + ?string $key = '__.o0=base64=Oo.__' + ?string $default = 'string' +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.php b/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.php index 26c1a50..b33b129 100644 --- a/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.php +++ b/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.php @@ -9,4 +9,57 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities; + + +use VDM\Joomla\Utilities\StringHelper; + + +/** + * The Base64 Helper + * + * @since 3.2.0 + */ +abstract class Base64Helper +{ + /** + * open base64 string if stored as base64 (in JCB) + * + * @param string|null $data The base64 string + * @param string|null $key We store the string with that suffix :) + * @param string|null $default The default switch + * + * @return string|null The opened string + * @since 3.2.0 + */ + public static function open(?string $data, ?string $key = '__.o0=base64=Oo.__', ?string $default = 'string'): ?string + { + // check that we have a string + if (StringHelper::check($data)) + { + // check if we have a key + if (StringHelper::check($key)) + { + if (strpos($data, $key) !== false) + { + return base64_decode(str_replace($key, '', $data)); + } + } + + // fallback to this, not perfect method + if (base64_encode(base64_decode($data, true)) === $data) + { + return base64_decode($data); + } + } + + // check if we should just return the string + if ('string' === $default) + { + return $data; + } + + return $default; + } +} + diff --git a/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.power b/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.power index 69309b0..4b7e602 100644 --- a/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.power +++ b/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.power @@ -1 +1,39 @@ -###CODEPOWER### \ No newline at end of file + /** + * open base64 string if stored as base64 (in JCB) + * + * @param string|null $data The base64 string + * @param string|null $key We store the string with that suffix :) + * @param string|null $default The default switch + * + * @return string|null The opened string + * @since 3.2.0 + */ + public static function open(?string $data, ?string $key = '__.o0=base64=Oo.__', ?string $default = 'string'): ?string + { + // check that we have a string + if (StringHelper::check($data)) + { + // check if we have a key + if (StringHelper::check($key)) + { + if (strpos($data, $key) !== false) + { + return base64_decode(str_replace($key, '', $data)); + } + } + + // fallback to this, not perfect method + if (base64_encode(base64_decode($data, true)) === $data) + { + return base64_decode($data); + } + } + + // check if we should just return the string + if ('string' === $default) + { + return $data; + } + + return $default; + } \ No newline at end of file diff --git a/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/settings.json b/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/settings.json index 6b3b222..c524c34 100644 --- a/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/settings.json +++ b/src/64a6ff6c-069c-4a11-a76b-db5e36c27690/settings.json @@ -1 +1,23 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "64a6ff6c-069c-4a11-a76b-db5e36c27690", + "implements": null, + "load_selection": null, + "name": "Base64Helper", + "power_version": "1.0.0", + "system_name": "Utilities Base64 Helper", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Utilities.Base64Helper", + "description": "The Base64 Helper\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/64e291c2-11f1-423d-a44d-837cc12cc017/README.md b/src/64e291c2-11f1-423d-a44d-837cc12cc017/README.md index 433b69e..81d72ab 100644 --- a/src/64e291c2-11f1-423d-a44d-837cc12cc017/README.md +++ b/src/64e291c2-11f1-423d-a44d-837cc12cc017/README.md @@ -1 +1,85 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# interface Registryinterface (Details) +> namespace: **VDM\Joomla\Interfaces** +```uml +@startuml +interface Registryinterface #Lavender { + + set(string $path, mixed $value) : void + + add(string $path, mixed $value, ...) : void + + get(string $path, mixed $default = null) : mixed + + remove(string $path) : void + + exists(string $path) : bool + + setSeparator(?string $value) : void +} + +note right of Registryinterface::set + Sets a value into the registry using multiple keys. + + since: 3.2.0 + return: void +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 + + arguments: + string $path + mixed $value + ?bool $asArray = null +end note + +note right of Registryinterface::get + Retrieves a value (or sub-array) from the registry using multiple keys. + + since: 3.2.0 + return: mixed +end note + +note right of Registryinterface::remove + Removes a value (or sub-array) from the registry using multiple keys. + + since: 3.2.0 + return: void +end note + +note right of Registryinterface::exists + Checks the existence of a particular location in the registry using multiple keys. + + since: 3.2.0 + return: bool +end note + +note right of Registryinterface::setSeparator + Sets a separator value + + since: 3.2.0 + return: void +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php b/src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php index 26c1a50..58eab82 100644 --- a/src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php +++ b/src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php @@ -9,4 +9,86 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Interfaces; + + +/** + * The Registry Interface + * + * @since 3.2.0 + */ +interface Registryinterface +{ + /** + * Sets a value into the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $value Value of entry + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return void + * @since 3.2.0 + */ + public function set(string $path, $value): void; + + /** + * 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|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 = null): void; + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $default Optional default value, returned if the internal doesn't exist. + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function get(string $path, $default = null); + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return void + * @since 3.2.0 + */ + public function remove(string $path): void; + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function exists(string $path): bool; + + /** + * Sets a separator value + * + * @param string|null $value The value to set. + * + * @return void + * @since 3.2.0 + */ + public function setSeparator(?string $value): void; +} + diff --git a/src/64e291c2-11f1-423d-a44d-837cc12cc017/code.power b/src/64e291c2-11f1-423d-a44d-837cc12cc017/code.power index 69309b0..b454600 100644 --- a/src/64e291c2-11f1-423d-a44d-837cc12cc017/code.power +++ b/src/64e291c2-11f1-423d-a44d-837cc12cc017/code.power @@ -1 +1,71 @@ -###CODEPOWER### \ No newline at end of file + /** + * Sets a value into the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $value Value of entry + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return void + * @since 3.2.0 + */ + public function set(string $path, $value): void; + + /** + * 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|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 = null): void; + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $default Optional default value, returned if the internal doesn't exist. + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function get(string $path, $default = null); + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return void + * @since 3.2.0 + */ + public function remove(string $path): void; + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function exists(string $path): bool; + + /** + * Sets a separator value + * + * @param string|null $value The value to set. + * + * @return void + * @since 3.2.0 + */ + public function setSeparator(?string $value): void; \ No newline at end of file diff --git a/src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json b/src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json index 6b3b222..49fdc59 100644 --- a/src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json +++ b/src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "64e291c2-11f1-423d-a44d-837cc12cc017", + "implements": null, + "load_selection": null, + "name": "Registryinterface", + "power_version": "1.0.0", + "system_name": "VDM.Interfaces.Registryinterface", + "type": "interface", + "use_selection": null, + "namespace": "VDM\\Joomla\\Interfaces.Registryinterface", + "description": "The Registry Interface\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/README.md b/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/README.md index 433b69e..2fca2b3 100644 --- a/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/README.md +++ b/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/README.md @@ -1 +1,55 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class Database (Details) +> namespace: **VDM\Joomla\Abstraction** +```uml +@startuml +abstract Database #Orange { + # $db + # string $table + + __construct() + # quote(mixed $value) : mixed + # getTable(string $table) : string +} + +note right of Database::__construct + Constructor + + since: 3.2.0 +end note + +note right of Database::quote + Set a value based on data type + + since: 3.2.0 + return: mixed +end note + +note right of Database::getTable + Set a table name, adding the +core component as needed + + since: 3.2.0 + return: string +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.php b/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.php index 26c1a50..7e2a216 100644 --- a/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.php +++ b/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.php @@ -9,4 +9,107 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction; + + +use Joomla\CMS\Factory as JoomlaFactory; +use VDM\Joomla\Utilities\Component\Helper; + + +/** + * Database + * + * @since 3.2.0 + */ +abstract class Database +{ + /** + * Database object to query local DB + * + * @since 3.2.0 + */ + protected $db; + + /** + * Core Component Table Name + * + * @var string + * @since 3.2.0 + */ + protected string $table; + + /** + * Constructor + * + * @throws \Exception + * @since 3.2.0 + */ + public function __construct() + { + $this->db = JoomlaFactory::getDbo(); + + // set the component table + $this->table = '#__' . Helper::getCode(); + } + + /** + * Set a value based on data type + * + * @param mixed $value The value to set + * + * @return mixed + * @since 3.2.0 + **/ + protected function quote($value) + { + if ($value === null) // hmm the null does pose an issue (will keep an eye on this) + { + return 'NULL'; + } + + if (is_numeric($value)) + { + if (filter_var($value, FILTER_VALIDATE_INT)) + { + return (int) $value; + } + elseif (filter_var($value, FILTER_VALIDATE_FLOAT)) + { + return (float) $value; + } + } + elseif (is_bool($value)) // not sure if this will work well (but its correct) + { + return $value ? 'TRUE' : 'FALSE'; + } + + // For date and datetime values + if ($value instanceof \DateTime) + { + return $this->db->quote($value->format('Y-m-d H:i:s')); + } + + // For other data types, just escape it + return $this->db->quote($value); + } + + /** + * Set a table name, adding the + * core component as needed + * + * @param string $table The table string + * + * @return string + * @since 3.2.0 + **/ + protected function getTable(string $table): string + { + if (strpos($table, '#__') === false) + { + return $this->table . '_' . $table; + } + + return $table; + } +} + diff --git a/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.power b/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.power index 69309b0..f03324b 100644 --- a/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.power +++ b/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.power @@ -1 +1,88 @@ -###CODEPOWER### \ No newline at end of file + /** + * Database object to query local DB + * + * @since 3.2.0 + */ + protected $db; + + /** + * Core Component Table Name + * + * @var string + * @since 3.2.0 + */ + protected string $table; + + /** + * Constructor + * + * @throws \Exception + * @since 3.2.0 + */ + public function __construct() + { + $this->db = JoomlaFactory::getDbo(); + + // set the component table + $this->table = '#__' . Helper::getCode(); + } + + /** + * Set a value based on data type + * + * @param mixed $value The value to set + * + * @return mixed + * @since 3.2.0 + **/ + protected function quote($value) + { + if ($value === null) // hmm the null does pose an issue (will keep an eye on this) + { + return 'NULL'; + } + + if (is_numeric($value)) + { + if (filter_var($value, FILTER_VALIDATE_INT)) + { + return (int) $value; + } + elseif (filter_var($value, FILTER_VALIDATE_FLOAT)) + { + return (float) $value; + } + } + elseif (is_bool($value)) // not sure if this will work well (but its correct) + { + return $value ? 'TRUE' : 'FALSE'; + } + + // For date and datetime values + if ($value instanceof \DateTime) + { + return $this->db->quote($value->format('Y-m-d H:i:s')); + } + + // For other data types, just escape it + return $this->db->quote($value); + } + + /** + * Set a table name, adding the + * core component as needed + * + * @param string $table The table string + * + * @return string + * @since 3.2.0 + **/ + protected function getTable(string $table): string + { + if (strpos($table, '#__') === false) + { + return $this->table . '_' . $table; + } + + return $table; + } \ No newline at end of file diff --git a/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/settings.json b/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/settings.json index 6b3b222..721443f 100644 --- a/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/settings.json +++ b/src/6cbef8f8-4813-48e3-b05a-65e1aea95171/settings.json @@ -1 +1,23 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "0", + "guid": "6cbef8f8-4813-48e3-b05a-65e1aea95171", + "implements": null, + "load_selection": null, + "name": "Database", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.Database", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "640b5352-fb09-425f-a26e-cd44eda03f15", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Abstraction.Database", + "description": "Database\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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\\CMS\\Factory as JoomlaFactory;", + "composer": "" +} \ No newline at end of file diff --git a/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/README.md b/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/README.md index 433b69e..6b280a1 100644 --- a/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/README.md +++ b/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/README.md @@ -1 +1,83 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# interface UpdateInterface (Details) +> namespace: **VDM\Joomla\Interfaces** +```uml +@startuml +interface UpdateInterface #Lavender { + + rows(array $data, string $key, ...) : bool + + items(array $data, string $key, ...) : bool + + row(array $data, string $key, ...) : bool + + item(object $data, string $key, ...) : bool +} + +note right of UpdateInterface::rows + Update rows in the database (with remapping and filtering columns option) + + since: 3.2.0 + return: bool + + arguments: + array $data + string $key + string $table + array $columns = [] +end note + +note right of UpdateInterface::items + Update items in the database (with remapping and filtering columns option) + + since: 3.2.0 + return: bool + + arguments: + array $data + string $key + string $table + array $columns = [] +end note + +note right of UpdateInterface::row + Update row in the database + + since: 3.2.0 + return: bool + + arguments: + array $data + string $key + string $table +end note + +note right of UpdateInterface::item + Update item in the database + + since: 3.2.0 + return: bool + + arguments: + object $data + string $key + string $table +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php b/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php index 26c1a50..3e43b16 100644 --- a/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php +++ b/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php @@ -9,4 +9,64 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Interfaces; + + +/** + * Database Update Interface + * + * @since 3.2.0 + */ +interface UpdateInterface +{ + /** + * Update rows in the database (with remapping and filtering columns option) + * + * @param array $data Dataset to update in database [array of arrays (key => value)] + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function rows(array $data, string $key, string $table, array $columns = []): bool; + + /** + * Update items in the database (with remapping and filtering columns option) + * + * @param array $data Data to updated in database (array of objects) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being update + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function items(array $data, string $key, string $table, array $columns = []): bool; + + /** + * Update row in the database + * + * @param array $data Dataset to update in database (key => value) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * + * @return bool + * @since 3.2.0 + **/ + public function row(array $data, string $key, string $table): bool; + + /** + * Update item in the database + * + * @param object $data Dataset to update in database (key => value) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * + * @return bool + * @since 3.2.0 + **/ + public function item(object $data, string $key, string $table): bool; +} + diff --git a/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.power b/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.power index 69309b0..0e35a6f 100644 --- a/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.power +++ b/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.power @@ -1 +1,49 @@ -###CODEPOWER### \ No newline at end of file + /** + * Update rows in the database (with remapping and filtering columns option) + * + * @param array $data Dataset to update in database [array of arrays (key => value)] + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function rows(array $data, string $key, string $table, array $columns = []): bool; + + /** + * Update items in the database (with remapping and filtering columns option) + * + * @param array $data Data to updated in database (array of objects) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being update + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function items(array $data, string $key, string $table, array $columns = []): bool; + + /** + * Update row in the database + * + * @param array $data Dataset to update in database (key => value) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * + * @return bool + * @since 3.2.0 + **/ + public function row(array $data, string $key, string $table): bool; + + /** + * Update item in the database + * + * @param object $data Dataset to update in database (key => value) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * + * @return bool + * @since 3.2.0 + **/ + public function item(object $data, string $key, string $table): bool; \ No newline at end of file diff --git a/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json b/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json index 6b3b222..029b623 100644 --- a/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json +++ b/src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "7179fde6-1e51-4b51-8545-7ca18f74a0f4", + "implements": null, + "load_selection": null, + "name": "UpdateInterface", + "power_version": "1.0.0", + "system_name": "VDM.Interfaces.UpdateInterface", + "type": "interface", + "use_selection": null, + "namespace": "VDM\\Joomla\\Interfaces.UpdateInterface", + "description": "Database Update Interface\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/README.md b/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/README.md index 433b69e..ca9b090 100644 --- a/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/README.md +++ b/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/README.md @@ -1 +1,37 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# trait ToString (Details) +> namespace: **VDM\Joomla\Abstraction\Registry\Traits** +```uml +@startuml +class ToString << (T,Orange) >> #Turquoise { + + toString(string $path, string $separator = '') : string +} + +note right of ToString::toString + Convert an array of values to a string (or return string) + + since: 3.2.0 + return: string +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.php b/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.php index 26c1a50..285f709 100644 --- a/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.php +++ b/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.php @@ -9,4 +9,47 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction\Registry\Traits; + + +/** + * To String Values + * + * @since 3.2.0 + */ +trait ToString +{ + /** + * Convert an array of values to a string (or return string) + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * @param string $seperator Return string separator + * + * @return string + * @since 3.2.0 + */ + public function toString(string $path, string $separator = ''): string + { + // Return default value if path is empty + if (empty($path)) + { + return ''; + } + + // get the value + if (($node = $this->get($path)) !== null) + { + if (is_array($node) && $node !== []) + { + return implode($separator, $node); + } + elseif (is_string($node) && strlen((string) $node) > 0) + { + return $node; + } + } + + return ''; + } +} + diff --git a/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.power b/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.power index 69309b0..90e68f7 100644 --- a/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.power +++ b/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.power @@ -1 +1,32 @@ -###CODEPOWER### \ No newline at end of file + /** + * Convert an array of values to a string (or return string) + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * @param string $seperator Return string separator + * + * @return string + * @since 3.2.0 + */ + public function toString(string $path, string $separator = ''): string + { + // Return default value if path is empty + if (empty($path)) + { + return ''; + } + + // get the value + if (($node = $this->get($path)) !== null) + { + if (is_array($node) && $node !== []) + { + return implode($separator, $node); + } + elseif (is_string($node) && strlen((string) $node) > 0) + { + return $node; + } + } + + return ''; + } \ No newline at end of file diff --git a/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/settings.json b/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/settings.json index 6b3b222..0c5863f 100644 --- a/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/settings.json +++ b/src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "7d494d91-ab60-43cd-aecf-d50e07f7f30e", + "implements": null, + "load_selection": null, + "name": "ToString", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.Registry.Traits.ToString", + "type": "trait", + "use_selection": null, + "namespace": "VDM\\Joomla\\Abstraction.Registry.Traits.ToString", + "description": "To String Values\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/README.md b/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/README.md index 433b69e..b28a1d2 100644 --- a/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/README.md +++ b/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/README.md @@ -1 +1,95 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class Registry (Details) +> namespace: **VDM\Joomla\Abstraction** +> extends: **ActiveRegistry** +```uml +@startuml +abstract Registry #Orange { + # ?string $separator + + set(string $path, mixed $value) : void + + add(string $path, mixed $value, ...) : void + + get(string $path, mixed $default = null) : mixed + + remove(string $path) : void + + exists(string $path) : bool + + setSeparator(?string $value) : void + # getActiveKeys(string $path) : ?array +} + +note right of Registry::set + Sets a value into the registry using multiple keys. + + since: 3.2.0 + return: void +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 + + arguments: + string $path + mixed $value + ?bool $asArray = null +end note + +note right of Registry::get + Retrieves a value (or sub-array) from the registry using multiple keys. + + since: 3.2.0 + return: mixed +end note + +note right of Registry::remove + Removes a value (or sub-array) from the registry using multiple keys. + + since: 3.2.0 + return: void +end note + +note right of Registry::exists + Checks the existence of a particular location in the registry using multiple keys. + + since: 3.2.0 + return: bool +end note + +note right of Registry::setSeparator + Sets a separator value + + since: 3.2.0 + return: void +end note + +note right of Registry::getActiveKeys + Get that the active keys from a path + + since: 3.2.0 + return: ?array +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/code.php b/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/code.php index 26c1a50..fe11328 100644 --- a/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/code.php +++ b/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/code.php @@ -9,4 +9,176 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction; + + +use VDM\Joomla\Interfaces\Activeregistryinterface; +use VDM\Joomla\Interfaces\Registryinterface; +use VDM\Joomla\Abstraction\ActiveRegistry; + + +/** + * VDM Basic Registry. + * + * Don't use this beyond 10 dimensional depth for best performance. + * + * @since 3.2.0 + */ +abstract class Registry extends ActiveRegistry implements Activeregistryinterface, Registryinterface +{ + /** + * Path separator + * + * @var string|null + * @since 3.2.0 + */ + protected ?string $separator = '.'; + + /** + * Sets a value into the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $value Value of entry + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return void + * @since 3.2.0 + */ + public function set(string $path, $value): void + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to set any value."); + } + + $this->setActive($value, ...$keys); + } + + /** + * 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|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 = null): void + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to add any value."); + } + + $this->addActive($value, $asArray, ...$keys); + } + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $default Optional default value, returned if the internal doesn't exist. + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function get(string $path, $default = null) + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to get any value."); + } + + return $this->getActive($default, ...$keys); + } + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return void + * @since 3.2.0 + */ + public function remove(string $path): void + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to remove any value."); + } + + $this->removeActive(...$keys); + } + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function exists(string $path): bool + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to check if any value exist."); + } + + return $this->existsActive(...$keys); + } + + /** + * Sets a separator value + * + * @param string|null $value The value to set. + * + * @return void + * @since 3.2.0 + */ + public function setSeparator(?string $value): void + { + $this->separator = $value; + } + + /** + * Get that the active keys from a path + * + * @param string $path The path to determine the location registry. + * + * @return array|null The valid array of keys + * @since 3.2.0 + */ + protected function getActiveKeys(string $path): ?array + { + // empty path no allowed + if ($path === '') + { + return null; + } + + // Flatten the path + if ($this->separator === null || $this->separator === '') + { + return [$path]; + } + + $keys = array_values(array_filter(explode($this->separator, $path), 'strlen')); + + if (empty($keys)) + { + return null; + } + + return $keys; + } +} + diff --git a/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/code.power b/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/code.power index 69309b0..d58e1de 100644 --- a/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/code.power +++ b/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/code.power @@ -1 +1,154 @@ -###CODEPOWER### \ No newline at end of file + /** + * Path separator + * + * @var string|null + * @since 3.2.0 + */ + protected ?string $separator = '.'; + + /** + * Sets a value into the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $value Value of entry + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return void + * @since 3.2.0 + */ + public function set(string $path, $value): void + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to set any value."); + } + + $this->setActive($value, ...$keys); + } + + /** + * 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|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 = null): void + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to add any value."); + } + + $this->addActive($value, $asArray, ...$keys); + } + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $default Optional default value, returned if the internal doesn't exist. + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function get(string $path, $default = null) + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to get any value."); + } + + return $this->getActive($default, ...$keys); + } + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return void + * @since 3.2.0 + */ + public function remove(string $path): void + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to remove any value."); + } + + $this->removeActive(...$keys); + } + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function exists(string $path): bool + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to check if any value exist."); + } + + return $this->existsActive(...$keys); + } + + /** + * Sets a separator value + * + * @param string|null $value The value to set. + * + * @return void + * @since 3.2.0 + */ + public function setSeparator(?string $value): void + { + $this->separator = $value; + } + + /** + * Get that the active keys from a path + * + * @param string $path The path to determine the location registry. + * + * @return array|null The valid array of keys + * @since 3.2.0 + */ + protected function getActiveKeys(string $path): ?array + { + // empty path no allowed + if ($path === '') + { + return null; + } + + // Flatten the path + if ($this->separator === null || $this->separator === '') + { + return [$path]; + } + + $keys = array_values(array_filter(explode($this->separator, $path), 'strlen')); + + if (empty($keys)) + { + return null; + } + + return $keys; + } \ No newline at end of file diff --git a/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/settings.json b/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/settings.json index 6b3b222..c5b0e6d 100644 --- a/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/settings.json +++ b/src/7e822c03-1b20-41d1-9427-f5b8d5836af7/settings.json @@ -1 +1,21 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "43134867-5cb8-4280-9be8-309fd2fd135f", + "guid": "7e822c03-1b20-41d1-9427-f5b8d5836af7", + "implements": [ + "af0eedbe-603b-4671-8e5a-28165d88254b", + "64e291c2-11f1-423d-a44d-837cc12cc017" + ], + "load_selection": null, + "name": "Registry", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.Registry", + "type": "abstract class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Abstraction.Registry", + "description": "VDM Basic Registry.\r\n\r\nDon't use this beyond 10 dimensional depth for best performance.\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/README.md b/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/README.md index 433b69e..de28668 100644 --- a/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/README.md +++ b/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/README.md @@ -1 +1,88 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# interface ModelInterface (Details) +> namespace: **VDM\Joomla\Interfaces** +```uml +@startuml +interface ModelInterface #Lavender { + + value(mixed $value, string $field, ...) : mixed + + item(object $item, ?string $table = null) : ?object + + items(?array $items = null, ?string $table = null) : ?array + + row(array $item, ?string $table = null) : ?array + + rows(?array $items = null, ?string $table = null) : ?array + + last(?string $table = null) : ?int +} + +note right of ModelInterface::value + Model the value +Example: $this->value(value, 'value_key', 'table_name'); + + since: 3.2.0 + return: mixed + + arguments: + mixed $value + string $field + ?string $table = null +end note + +note right of ModelInterface::item + Model the values of an item +Example: $this->item(Object, 'table_name'); + + since: 3.2.0 + return: ?object +end note + +note right of ModelInterface::items + Model the values of multiple items +Example: $this->items(Array, 'table_name'); + + since: 3.2.0 + return: ?array +end note + +note right of ModelInterface::row + Model the values of an row +Example: $this->item(Array, 'table_name'); + + since: 3.2.0 + return: ?array +end note + +note right of ModelInterface::rows + Model the values of multiple rows +Example: $this->items(Array, 'table_name'); + + since: 3.2.0 + return: ?array +end note + +note right of ModelInterface::last + Get last modeled ID +Example: $this->last('table_name'); + + since: 3.2.0 + return: ?int +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.php b/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.php index 26c1a50..51f3424 100644 --- a/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.php +++ b/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.php @@ -9,4 +9,86 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Interfaces; + + +/** + * Model Interface + * + * @since 3.2.0 + */ +interface ModelInterface +{ + /** + * Model the value + * Example: $this->value(value, 'value_key', 'table_name'); + * + * @param mixed $value The value to model + * @param string $field The field key + * @param string|null $table The table + * + * @return mixed + * @since 3.2.0 + */ + public function value($value, string $field, ?string $table = null); + + /** + * Model the values of an item + * Example: $this->item(Object, 'table_name'); + * + * @param object $item The item object + * @param string|null $table The table + * + * @return object|null + * @since 3.2.0 + */ + public function item(object $item, ?string $table = null): ?object; + + /** + * Model the values of multiple items + * Example: $this->items(Array, 'table_name'); + * + * @param array|null $items The array of item objects + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function items(?array $items = null, ?string $table = null): ?array; + + /** + * Model the values of an row + * Example: $this->item(Array, 'table_name'); + * + * @param array $item The item array + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function row(array $item, ?string $table = null): ?array; + + /** + * Model the values of multiple rows + * Example: $this->items(Array, 'table_name'); + * + * @param array|null $items The array of item array + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function rows(?array $items = null, ?string $table = null): ?array; + + /** + * Get last modeled ID + * Example: $this->last('table_name'); + * + * @param string|null $table The table + * + * @return int|null + * @since 3.2.0 + */ + public function last(?string $table = null): ?int; +} + diff --git a/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.power b/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.power index 69309b0..043438c 100644 --- a/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.power +++ b/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.power @@ -1 +1,71 @@ -###CODEPOWER### \ No newline at end of file + /** + * Model the value + * Example: $this->value(value, 'value_key', 'table_name'); + * + * @param mixed $value The value to model + * @param string $field The field key + * @param string|null $table The table + * + * @return mixed + * @since 3.2.0 + */ + public function value($value, string $field, ?string $table = null); + + /** + * Model the values of an item + * Example: $this->item(Object, 'table_name'); + * + * @param object $item The item object + * @param string|null $table The table + * + * @return object|null + * @since 3.2.0 + */ + public function item(object $item, ?string $table = null): ?object; + + /** + * Model the values of multiple items + * Example: $this->items(Array, 'table_name'); + * + * @param array|null $items The array of item objects + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function items(?array $items = null, ?string $table = null): ?array; + + /** + * Model the values of an row + * Example: $this->item(Array, 'table_name'); + * + * @param array $item The item array + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function row(array $item, ?string $table = null): ?array; + + /** + * Model the values of multiple rows + * Example: $this->items(Array, 'table_name'); + * + * @param array|null $items The array of item array + * @param string|null $table The table + * + * @return array|null + * @since 3.2.0 + */ + public function rows(?array $items = null, ?string $table = null): ?array; + + /** + * Get last modeled ID + * Example: $this->last('table_name'); + * + * @param string|null $table The table + * + * @return int|null + * @since 3.2.0 + */ + public function last(?string $table = null): ?int; \ No newline at end of file diff --git a/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/settings.json b/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/settings.json index 6b3b222..7d85043 100644 --- a/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/settings.json +++ b/src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff", + "implements": null, + "load_selection": null, + "name": "ModelInterface", + "power_version": "1.0.0", + "system_name": "VDM.Interfaces.ModelInterface", + "type": "interface", + "use_selection": null, + "namespace": "VDM\\Joomla\\Interfaces.ModelInterface", + "description": "Model Interface\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/91004529-94a9-4590-b842-e7c6b624ecf5/README.md b/src/91004529-94a9-4590-b842-e7c6b624ecf5/README.md index 433b69e..53c21be 100644 --- a/src/91004529-94a9-4590-b842-e7c6b624ecf5/README.md +++ b/src/91004529-94a9-4590-b842-e7c6b624ecf5/README.md @@ -1 +1,47 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class ObjectHelper (Details) +> namespace: **VDM\Joomla\Utilities** +```uml +@startuml +abstract ObjectHelper #Orange { + + {static} check($object) + + {static} equal(?object $obj1, ?object $obj2) : bool +} + +note right of ObjectHelper::check + Check if have an object with a length + + since: 3.0.9 +end note + +note right of ObjectHelper::equal + Compare two objects for equality based on their property values. +Note that this method works only for simple objects that don't +contain any nested objects or resource references. If you need +to compare more complex objects, you may need to use a +more advanced method such as serialization or reflection. + + return: bool +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/91004529-94a9-4590-b842-e7c6b624ecf5/code.php b/src/91004529-94a9-4590-b842-e7c6b624ecf5/code.php index b9a864e..2646f7c 100644 --- a/src/91004529-94a9-4590-b842-e7c6b624ecf5/code.php +++ b/src/91004529-94a9-4590-b842-e7c6b624ecf5/code.php @@ -9,4 +9,70 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities; + + +/** + * Some object tricks + * + * @since 3.0.9 + */ +abstract class ObjectHelper +{ + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($object) + { + if (is_object($object)) + { + return count((array) $object) > 0; + } + + return false; + } + + /** + * Compare two objects for equality based on their property values. + * + * Note that this method works only for simple objects that don't + * contain any nested objects or resource references. If you need + * to compare more complex objects, you may need to use a + * more advanced method such as serialization or reflection. + * + * @param object|null $obj1 The first object to compare. + * @param object|null $obj2 The second object to compare. + * + * @return bool True if the objects have the same key-value pairs and false otherwise. + */ + public static function equal(?object $obj1, ?object $obj2): bool + { + // if any is null we return false as that means there is a none object + // we are not comparing null but objects + // but we allow null as some objects while + // not instantiate are still null + if (is_null($obj1) || is_null($obj2)) + { + return false; + } + + // Convert the objects to arrays of their property values using get_object_vars. + $array1 = get_object_vars($obj1); + $array2 = get_object_vars($obj2); + + // Compare the arrays using array_diff_assoc to detect any differences. + $diff1 = array_diff_assoc($array1, $array2); + $diff2 = array_diff_assoc($array2, $array1); + + // If the arrays have the same key-value pairs, they will have no differences, so return true. + return empty($diff1) && empty($diff2); + } + +} + diff --git a/src/91004529-94a9-4590-b842-e7c6b624ecf5/code.power b/src/91004529-94a9-4590-b842-e7c6b624ecf5/code.power index 69309b0..026df61 100644 --- a/src/91004529-94a9-4590-b842-e7c6b624ecf5/code.power +++ b/src/91004529-94a9-4590-b842-e7c6b624ecf5/code.power @@ -1 +1,54 @@ -###CODEPOWER### \ No newline at end of file + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($object) + { + if (is_object($object)) + { + return count((array) $object) > 0; + } + + return false; + } + + /** + * Compare two objects for equality based on their property values. + * + * Note that this method works only for simple objects that don't + * contain any nested objects or resource references. If you need + * to compare more complex objects, you may need to use a + * more advanced method such as serialization or reflection. + * + * @param object|null $obj1 The first object to compare. + * @param object|null $obj2 The second object to compare. + * + * @return bool True if the objects have the same key-value pairs and false otherwise. + */ + public static function equal(?object $obj1, ?object $obj2): bool + { + // if any is null we return false as that means there is a none object + // we are not comparing null but objects + // but we allow null as some objects while + // not instantiate are still null + if (is_null($obj1) || is_null($obj2)) + { + return false; + } + + // Convert the objects to arrays of their property values using get_object_vars. + $array1 = get_object_vars($obj1); + $array2 = get_object_vars($obj2); + + // Compare the arrays using array_diff_assoc to detect any differences. + $diff1 = array_diff_assoc($array1, $array2); + $diff2 = array_diff_assoc($array2, $array1); + + // If the arrays have the same key-value pairs, they will have no differences, so return true. + return empty($diff1) && empty($diff2); + } diff --git a/src/91004529-94a9-4590-b842-e7c6b624ecf5/settings.json b/src/91004529-94a9-4590-b842-e7c6b624ecf5/settings.json index 6b3b222..36f382c 100644 --- a/src/91004529-94a9-4590-b842-e7c6b624ecf5/settings.json +++ b/src/91004529-94a9-4590-b842-e7c6b624ecf5/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "91004529-94a9-4590-b842-e7c6b624ecf5", + "implements": null, + "load_selection": null, + "name": "ObjectHelper", + "power_version": "1.0.0", + "system_name": "Utilities Object Helper", + "type": "abstract class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Utilities.ObjectHelper", + "description": "Some object tricks\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/README.md b/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/README.md index 433b69e..6fb7d9c 100644 --- a/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/README.md +++ b/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/README.md @@ -1 +1,80 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class GuidHelper (Details) +> namespace: **VDM\Joomla\Utilities** +```uml +@startuml +abstract GuidHelper #Orange { + + {static} get(bool $trim = true) : string + + {static} valid(string $guid, ?string $table = null, ...) : bool + + {static} item(string $guid, string $table, ...) : mixed + # {static} validate(string $guid) : bool +} + +note right of GuidHelper::get + 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 right of GuidHelper::valid + 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 $component = null +end note + +note right of GuidHelper::item + get the item by guid in a table + + since: 3.0.9 + return: mixed + + arguments: + string $guid + string $table + string|array $what = 'a.id' + ?string $component = null +end note + +note right of GuidHelper::validate + Validate the Globally Unique Identifier +Thanks to Lewie +https://stackoverflow.com/a/1515456/1429677 + + since: 3.0.9 + return: bool +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.php b/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.php index b9a864e..14a1148 100644 --- a/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.php +++ b/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.php @@ -9,4 +9,207 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Factory; +use VDM\Joomla\Utilities\Component\Helper; + + +/** + * Global Unique ID Helper + * + * @since 3.0.9 + */ +abstract class GuidHelper +{ + /** + * 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 + */ + public static function get(bool $trim = true): string + { + // Windows + if (function_exists('com_create_guid')) + { + if ($trim) + { + return trim(com_create_guid(), '{}'); + } + return com_create_guid(); + } + + // set the braces if needed + $lbrace = $trim ? "" : chr(123); // "{" + $rbrace = $trim ? "" : chr(125); // "}" + + // OSX/Linux + if (function_exists('openssl_random_pseudo_bytes')) + { + $data = openssl_random_pseudo_bytes(16); + $data[6] = chr( ord($data[6]) & 0x0f | 0x40); // set version to 0100 + $data[8] = chr( ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 + return $lbrace . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . $lbrace; + } + + // Fallback (PHP 4.2+) + mt_srand((double) microtime() * 10000); + $charid = strtolower( md5( uniqid( rand(), true))); + $hyphen = chr(45); // "-" + $guidv4 = $lbrace. + substr($charid, 0, 8). $hyphen. + substr($charid, 8, 4). $hyphen. + substr($charid, 12, 4). $hyphen. + substr($charid, 16, 4). $hyphen. + substr($charid, 20, 12). + $rbrace; + return $guidv4; + } + + /** + * Validate the Globally Unique Identifier ( and check if table already has this identifier) + * + * @param string $guid + * @param string|null $table + * @param int $id + * @param string|null $component + * + * @return bool + * + * @since 3.0.9 + */ + public static function valid($guid, ?string $table = null, int $id = 0, ?string $component = null): bool + { + // check if we have a string + if (self::validate($guid)) + { + // check if table already has this identifier + if (StringHelper::check($table)) + { + // check that we have the component code name + if (!is_string($component)) + { + $component = (string) Helper::getCode(); + } + // Get the database object and a new query object. + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query->select('COUNT(*)') + ->from('#__' . (string) $component . '_' . (string) $table) + ->where($db->quoteName('guid') . ' = ' . $db->quote($guid)); + + // remove this item from the list + if ($id > 0) + { + $query->where($db->quoteName('id') . ' <> ' . (int) $id); + } + + // Set and query the database. + $db->setQuery($query); + $duplicate = (bool) $db->loadResult(); + + if ($duplicate) + { + return false; + } + } + return true; + } + return false; + } + + /** + * get the item by guid in a table + * + * @param string $guid + * @param string $table + * @param string|array $what + * @param string|null $component + * + * @return mixed + * + * @since 3.0.9 + */ + public static function item($guid, $table, $what = 'a.id', ?string $component = null) + { + // check if we have a string + // check if table already has this identifier + if (self::validate($guid) && StringHelper::check($table)) + { + // check that we have the component code name + if (!is_string($component)) + { + $component = (string) Helper::getCode(); + } + // Get the database object and a new query object. + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + if (ArrayHelper::check($what)) + { + $query->select($db->quoteName($what)); + } + else + { + $query->select($what); + } + + $query->from($db->quoteName('#__' . (string) $component . '_' . (string) $table, 'a')) + ->where($db->quoteName('a.guid') . ' = ' . $db->quote($guid)); + + // Set and query the database. + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + if (ArrayHelper::check($what) || $what === 'a.*') + { + return $db->loadObject(); + } + else + { + return $db->loadResult(); + } + } + } + + return null; + } + + /** + * Validate the Globally Unique Identifier + * + * Thanks to Lewie + * https://stackoverflow.com/a/1515456/1429677 + * + * @param string $guid + * + * @return bool + * + * @since 3.0.9 + */ + protected static function validate($guid) + { + // check if we have a string + if (StringHelper::check($guid)) + { + return preg_match("/^(\{)?[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}(?(1)\})$/i", $guid); + } + return false; + } + +} + diff --git a/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.power b/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.power index 69309b0..aebd1f1 100644 --- a/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.power +++ b/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.power @@ -1 +1,187 @@ -###CODEPOWER### \ No newline at end of file + /** + * 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 + */ + public static function get(bool $trim = true): string + { + // Windows + if (function_exists('com_create_guid')) + { + if ($trim) + { + return trim(com_create_guid(), '{}'); + } + return com_create_guid(); + } + + // set the braces if needed + $lbrace = $trim ? "" : chr(123); // "{" + $rbrace = $trim ? "" : chr(125); // "}" + + // OSX/Linux + if (function_exists('openssl_random_pseudo_bytes')) + { + $data = openssl_random_pseudo_bytes(16); + $data[6] = chr( ord($data[6]) & 0x0f | 0x40); // set version to 0100 + $data[8] = chr( ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 + return $lbrace . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . $lbrace; + } + + // Fallback (PHP 4.2+) + mt_srand((double) microtime() * 10000); + $charid = strtolower( md5( uniqid( rand(), true))); + $hyphen = chr(45); // "-" + $guidv4 = $lbrace. + substr($charid, 0, 8). $hyphen. + substr($charid, 8, 4). $hyphen. + substr($charid, 12, 4). $hyphen. + substr($charid, 16, 4). $hyphen. + substr($charid, 20, 12). + $rbrace; + return $guidv4; + } + + /** + * Validate the Globally Unique Identifier ( and check if table already has this identifier) + * + * @param string $guid + * @param string|null $table + * @param int $id + * @param string|null $component + * + * @return bool + * + * @since 3.0.9 + */ + public static function valid($guid, ?string $table = null, int $id = 0, ?string $component = null): bool + { + // check if we have a string + if (self::validate($guid)) + { + // check if table already has this identifier + if (StringHelper::check($table)) + { + // check that we have the component code name + if (!is_string($component)) + { + $component = (string) Helper::getCode(); + } + // Get the database object and a new query object. + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query->select('COUNT(*)') + ->from('#__' . (string) $component . '_' . (string) $table) + ->where($db->quoteName('guid') . ' = ' . $db->quote($guid)); + + // remove this item from the list + if ($id > 0) + { + $query->where($db->quoteName('id') . ' <> ' . (int) $id); + } + + // Set and query the database. + $db->setQuery($query); + $duplicate = (bool) $db->loadResult(); + + if ($duplicate) + { + return false; + } + } + return true; + } + return false; + } + + /** + * get the item by guid in a table + * + * @param string $guid + * @param string $table + * @param string|array $what + * @param string|null $component + * + * @return mixed + * + * @since 3.0.9 + */ + public static function item($guid, $table, $what = 'a.id', ?string $component = null) + { + // check if we have a string + // check if table already has this identifier + if (self::validate($guid) && StringHelper::check($table)) + { + // check that we have the component code name + if (!is_string($component)) + { + $component = (string) Helper::getCode(); + } + // Get the database object and a new query object. + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + if (ArrayHelper::check($what)) + { + $query->select($db->quoteName($what)); + } + else + { + $query->select($what); + } + + $query->from($db->quoteName('#__' . (string) $component . '_' . (string) $table, 'a')) + ->where($db->quoteName('a.guid') . ' = ' . $db->quote($guid)); + + // Set and query the database. + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + if (ArrayHelper::check($what) || $what === 'a.*') + { + return $db->loadObject(); + } + else + { + return $db->loadResult(); + } + } + } + + return null; + } + + /** + * Validate the Globally Unique Identifier + * + * Thanks to Lewie + * https://stackoverflow.com/a/1515456/1429677 + * + * @param string $guid + * + * @return bool + * + * @since 3.0.9 + */ + protected static function validate($guid) + { + // check if we have a string + if (StringHelper::check($guid)) + { + return preg_match("/^(\{)?[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}(?(1)\})$/i", $guid); + } + return false; + } diff --git a/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/settings.json b/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/settings.json index 6b3b222..dd5c31b 100644 --- a/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/settings.json +++ b/src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/settings.json @@ -1 +1,30 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "0", + "guid": "9c513baf-b279-43fd-ae29-a585c8cbc4f0", + "implements": null, + "load_selection": { + "load_selection0": { + "load": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a" + }, + "load_selection1": { + "load": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef" + } + }, + "name": "GuidHelper", + "power_version": "1.0.0", + "system_name": "Utilities GuidHelper", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "640b5352-fb09-425f-a26e-cd44eda03f15", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Utilities.GuidHelper", + "description": "Global Unique ID Helper\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 \r\n * @git 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\\CMS\\Factory;", + "composer": "" +} \ No newline at end of file diff --git a/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/README.md b/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/README.md index 433b69e..48fa006 100644 --- a/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/README.md +++ b/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/README.md @@ -1 +1,42 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class FieldHelper (Details) +> namespace: **VDM\Joomla\Utilities\String** +```uml +@startuml +abstract FieldHelper #Orange { + # static $builder + + {static} safe($string, $allcap = false, ...) +} + +note right of FieldHelper::safe + Making field names safe + + since: 3.0.9 + + arguments: + $string + $allcap = false + $spacer = '_' +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/code.php b/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/code.php index b9a864e..00a44d2 100644 --- a/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/code.php +++ b/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/code.php @@ -9,4 +9,93 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities\String; + + +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\Component\Helper; + + +/** + * Control the naming of a field + * + * @since 3.0.9 + */ +abstract class FieldHelper +{ + /** + * The field builder switch + * + * @since 3.0.9 + */ + protected static $builder = false; + + /** + * Making field names safe + * + * @input string The string 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 + */ + public static function safe($string, $allcap = false, $spacer = '_') + { + // get global value + if (self::$builder === false) + { + self::$builder = Helper::getParams()->get('field_name_builder', 1); + } + + // use the new convention + if (2 == self::$builder) + { + // 0nly continue if we have a string + if (StringHelper::check($string)) + { + // check that the first character is not a number + if (is_numeric(substr((string)$string, 0, 1))) + { + $string = StringHelper::numbers($string); + } + + // remove all other strange characters + $string = trim((string) $string); + $string = preg_replace('/'.$spacer.'+/', ' ', $string); + $string = preg_replace('/\s+/', ' ', $string); + + // Transliterate string + $string = StringHelper::transliterate($string); + + // remove all and keep only characters and numbers + $string = preg_replace("/[^A-Za-z0-9 ]/", '', (string) $string); + + // replace white space with underscore (SAFEST OPTION) + $string = preg_replace('/\s+/', (string) $spacer, $string); + + // return all caps + if ($allcap) + { + return strtoupper($string); + } + + // default is to return lower + return strtolower($string); + } + // not a string + return ''; + } + + // return all caps + if ($allcap) + { + return StringHelper::safe($string, 'U'); + } + + // use the default (original behavior/convention) + return StringHelper::safe($string); + } +} + diff --git a/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/code.power b/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/code.power index 69309b0..6ac4ef3 100644 --- a/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/code.power +++ b/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/code.power @@ -1 +1,74 @@ -###CODEPOWER### \ No newline at end of file + /** + * The field builder switch + * + * @since 3.0.9 + */ + protected static $builder = false; + + /** + * Making field names safe + * + * @input string The string 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 + */ + public static function safe($string, $allcap = false, $spacer = '_') + { + // get global value + if (self::$builder === false) + { + self::$builder = Helper::getParams()->get('field_name_builder', 1); + } + + // use the new convention + if (2 == self::$builder) + { + // 0nly continue if we have a string + if (StringHelper::check($string)) + { + // check that the first character is not a number + if (is_numeric(substr((string)$string, 0, 1))) + { + $string = StringHelper::numbers($string); + } + + // remove all other strange characters + $string = trim((string) $string); + $string = preg_replace('/'.$spacer.'+/', ' ', $string); + $string = preg_replace('/\s+/', ' ', $string); + + // Transliterate string + $string = StringHelper::transliterate($string); + + // remove all and keep only characters and numbers + $string = preg_replace("/[^A-Za-z0-9 ]/", '', (string) $string); + + // replace white space with underscore (SAFEST OPTION) + $string = preg_replace('/\s+/', (string) $spacer, $string); + + // return all caps + if ($allcap) + { + return strtoupper($string); + } + + // default is to return lower + return strtolower($string); + } + // not a string + return ''; + } + + // return all caps + if ($allcap) + { + return StringHelper::safe($string, 'U'); + } + + // use the default (original behavior/convention) + return StringHelper::safe($string); + } \ No newline at end of file diff --git a/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/settings.json b/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/settings.json index 6b3b222..336b860 100644 --- a/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/settings.json +++ b/src/9ef0eb24-aae4-4f5a-99af-d724db44808f/settings.json @@ -1 +1,27 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "9ef0eb24-aae4-4f5a-99af-d724db44808f", + "implements": null, + "load_selection": null, + "name": "FieldHelper", + "power_version": "1.0.0", + "system_name": "String Field Helper", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef", + "as": "default" + }, + "use_selection1": { + "use": "640b5352-fb09-425f-a26e-cd44eda03f15", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Utilities.String.FieldHelper", + "description": "Control the naming of a field\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/README.md b/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/README.md index 433b69e..1c755d7 100644 --- a/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/README.md +++ b/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/README.md @@ -1 +1,86 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class FileHelper (Details) +> namespace: **VDM\Joomla\Utilities** +```uml +@startuml +abstract FileHelper #Orange { + # static $curlError + + {static} zip(string $workingDirectory, string $filepath) : bool + + {static} getContent(string $path, mixed $none = '') : string + + {static} write(string $path, string $data) : bool + + {static} getPaths(string $folder, array $fileTypes = array('\.php') : array|null + + {static} getPath(string $type = 'path', string $target = 'filepath', ...) : string + + {static} exists(string $path) : bool +} + +note right of FileHelper::zip + The zipper method + + since: 3.0.9 + return: bool +end note + +note right of FileHelper::getContent + get the content of a file + + since: 3.0.9 + return: string +end note + +note right of FileHelper::write + Write a file to the server + + since: 3.0.9 + return: bool +end note + +note right of FileHelper::getPaths + get all the file paths in folder and sub folders + + since: 3.0.9 + return: array|null +end note + +note right of FileHelper::getPath + 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 right of FileHelper::exists + Check if file exist + + since: 3.0.9 + return: bool +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.php b/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.php index b9a864e..7d1dd0a 100644 --- a/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.php +++ b/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.php @@ -9,4 +9,355 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filesystem\Path; +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; +use Joomla\Archive\Archive; +use VDM\Joomla\Utilities\Component\Helper; + + +/** + * File helper + * + * @since 3.0.9 + */ +abstract class FileHelper +{ + /** + * Trigger error notice only once + * + * @var bool + * + * @since 3.0.9 + */ + protected static $curlError = false; + + /** + * The zipper method + * + * @param string $workingDirectory 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 + */ + public static function zip($workingDirectory, &$filepath): bool + { + // store the current joomla working directory + $joomla = getcwd(); + + // we are changing the working directory to the component temp folder + chdir($workingDirectory); + + // the full file path of the zip file + $filepath = Path::clean($filepath); + + // delete an existing zip file (or use an exclusion parameter in Folder::files() + File::delete($filepath); + + // get a list of files in the current directory tree (also the hidden files) + $files = Folder::files('.', '', true, true, array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array('.*~')); + + $zipArray = []; + // setup the zip array + foreach ($files as $file) + { + $tmp = []; + $tmp['name'] = str_replace('./', '', (string) $file); + $tmp['data'] = self::getContent($file); + $tmp['time'] = filemtime($file); + $zipArray[] = $tmp; + } + + // change back to joomla working directory + chdir($joomla); + + // get the zip adapter + $zip = (new Archive())->getAdapter('zip'); + + //create the zip file + return (bool) $zip->create($filepath, $zipArray); + } + + /** + * get the content of a file + * + * @param string $path The path to the file + * @param mixed $none The return value if no content was found + * + * @return string On success + * + * @since 3.0.9 + */ + public static function getContent($path, $none = '') + { + if (StringHelper::check($path)) + { + // use basic file get content for now + if (($content = @file_get_contents($path)) !== FALSE) + { + return $content; + } + // use curl if available + elseif (function_exists('curl_version')) + { + // start curl + $ch = curl_init(); + // set the options + $options = []; + $options[CURLOPT_URL] = $path; + $options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'; + $options[CURLOPT_RETURNTRANSFER] = TRUE; + $options[CURLOPT_SSL_VERIFYPEER] = FALSE; + // load the options + curl_setopt_array($ch, $options); + // get the content + $content = curl_exec($ch); + // close the connection + curl_close($ch); + + // return if found + if (StringHelper::check($content)) + { + return $content; + } + } + elseif (!self::$curlError) + { + // set the notice + Factory::getApplication()->enqueueMessage('

Curl Not Found!

Please setup curl on your system, or the Joomla Component will not function correctly!

', 'Error'); + // load this notice only once + self::$curlError = true; + } + } + return $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 + */ + public static function write($path, $data): bool + { + $klaar = false; + if (StringHelper::check($data)) + { + // open the file + $fh = fopen($path, "w"); + if (!is_resource($fh)) + { + return $klaar; + } + // write to the file + if (fwrite($fh, $data)) + { + // has been done + $klaar = true; + } + // close file. + fclose($fh); + } + return $klaar; + } + + /** + * 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 array|null + * + * @since 3.0.9 + */ + public static function getPaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true): ?array + { + if (Folder::exists($folder)) + { + // we must first store the current woking directory + $joomla = getcwd(); + // we are changing the working directory to the component path + chdir($folder); + + // make sure we have file type filter + if (ArrayHelper::check($fileTypes)) + { + // get the files + foreach ($fileTypes as $type) + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', $type, $recurse, $full); + } + } + elseif (StringHelper::check($fileTypes)) + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', $fileTypes, $recurse, $full); + } + else + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', '.', $recurse, $full); + } + + // change back to Joomla working directory + chdir($joomla); + + // return array of files + return array_map( fn($file) => str_replace('./', '/', (string) $file), (array) ArrayHelper::merge($files)); + } + return null; + } + + /** + * 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 + */ + 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)) + { + $default = JPATH_SITE . '/images/'; + } + + // get the global settings + $filePath = Helper::getParams()->get($target, $default); + + // check the file path (revert to default only of not a hidden file path) + if ('hiddenfilepath' !== $target && strpos((string) $filePath, (string) JPATH_SITE) === false) + { + $filePath = $default; + } + + // create the folder if it does not exist + if ($createIfNotSet && !Folder::exists($filePath)) + { + Folder::create($filePath); + } + + // setup the file name + $fileName = ''; + + // Get basic key + $basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug'; + // get the component helper + $helper = Helper::get(); + // check if method exist in helper class + if ($helper && Helper::methodExists('getCryptKey')) + { + $basickey = $helper::getCryptKey('basic', $basickey); + } + + // check the key + if (!StringHelper::check($key)) + { + $key = 'vDm'; + } + + // set the file name + if (StringHelper::check($fileType)) + { + // set the name + $fileName = trim( md5($type . $target . $basickey . $key) . '.' . trim($fileType, '.')); + } + else + { + $fileName = trim( md5($type . $target . $basickey . $key)) . '.txt'; + } + + // return the url + if ('url' === $type) + { + if (\strpos((string) $filePath, (string) JPATH_SITE) !== false) + { + $filePath = trim( str_replace( JPATH_SITE, '', (string) $filePath), '/'); + + return Uri::root() . $filePath . '/' . $fileName; + } + + // since the path is behind the root folder of the site, return only the root url (may be used to build the link) + return Uri::root(); + } + + // sanitize the path + return '/' . trim((string) $filePath, '/' ) . '/' . $fileName; + } + + /** + * Check if file exist + * + * @param string $path The url/path to check + * + * @return bool If exist true + * + * @since 3.0.9 + */ + public static function exists($path): bool + { + $exists = false; + // if this is a local path + if (strpos($path, 'http:') === false && strpos($path, 'https:') === false) + { + if (file_exists($path)) + { + $exists = true; + } + } + // check if we can use curl + elseif (function_exists('curl_version')) + { + // initiate curl + $ch = curl_init($path); + // CURLOPT_NOBODY (do not return body) + curl_setopt($ch, CURLOPT_NOBODY, true); + // make call + $result = curl_exec($ch); + // check return value + if ($result !== false) + { + // get the http CODE + $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + if ($statusCode !== 404) + { + $exists = true; + } + } + // close the connection + curl_close($ch); + } + elseif ($headers = @get_headers($path)) + { + if(isset($headers[0]) && is_string($headers[0]) && strpos($headers[0],'404') === false) + { + $exists = true; + } + } + return $exists; + } + +} + diff --git a/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.power b/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.power index 69309b0..b5d6bc7 100644 --- a/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.power +++ b/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.power @@ -1 +1,329 @@ -###CODEPOWER### \ No newline at end of file + /** + * Trigger error notice only once + * + * @var bool + * + * @since 3.0.9 + */ + protected static $curlError = false; + + /** + * The zipper method + * + * @param string $workingDirectory 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 + */ + public static function zip($workingDirectory, &$filepath): bool + { + // store the current joomla working directory + $joomla = getcwd(); + + // we are changing the working directory to the component temp folder + chdir($workingDirectory); + + // the full file path of the zip file + $filepath = Path::clean($filepath); + + // delete an existing zip file (or use an exclusion parameter in Folder::files() + File::delete($filepath); + + // get a list of files in the current directory tree (also the hidden files) + $files = Folder::files('.', '', true, true, array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array('.*~')); + + $zipArray = []; + // setup the zip array + foreach ($files as $file) + { + $tmp = []; + $tmp['name'] = str_replace('./', '', (string) $file); + $tmp['data'] = self::getContent($file); + $tmp['time'] = filemtime($file); + $zipArray[] = $tmp; + } + + // change back to joomla working directory + chdir($joomla); + + // get the zip adapter + $zip = (new Archive())->getAdapter('zip'); + + //create the zip file + return (bool) $zip->create($filepath, $zipArray); + } + + /** + * get the content of a file + * + * @param string $path The path to the file + * @param mixed $none The return value if no content was found + * + * @return string On success + * + * @since 3.0.9 + */ + public static function getContent($path, $none = '') + { + if (StringHelper::check($path)) + { + // use basic file get content for now + if (($content = @file_get_contents($path)) !== FALSE) + { + return $content; + } + // use curl if available + elseif (function_exists('curl_version')) + { + // start curl + $ch = curl_init(); + // set the options + $options = []; + $options[CURLOPT_URL] = $path; + $options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'; + $options[CURLOPT_RETURNTRANSFER] = TRUE; + $options[CURLOPT_SSL_VERIFYPEER] = FALSE; + // load the options + curl_setopt_array($ch, $options); + // get the content + $content = curl_exec($ch); + // close the connection + curl_close($ch); + + // return if found + if (StringHelper::check($content)) + { + return $content; + } + } + elseif (!self::$curlError) + { + // set the notice + Factory::getApplication()->enqueueMessage('

Curl Not Found!

Please setup curl on your system, or the Joomla Component will not function correctly!

', 'Error'); + // load this notice only once + self::$curlError = true; + } + } + return $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 + */ + public static function write($path, $data): bool + { + $klaar = false; + if (StringHelper::check($data)) + { + // open the file + $fh = fopen($path, "w"); + if (!is_resource($fh)) + { + return $klaar; + } + // write to the file + if (fwrite($fh, $data)) + { + // has been done + $klaar = true; + } + // close file. + fclose($fh); + } + return $klaar; + } + + /** + * 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 array|null + * + * @since 3.0.9 + */ + public static function getPaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true): ?array + { + if (Folder::exists($folder)) + { + // we must first store the current woking directory + $joomla = getcwd(); + // we are changing the working directory to the component path + chdir($folder); + + // make sure we have file type filter + if (ArrayHelper::check($fileTypes)) + { + // get the files + foreach ($fileTypes as $type) + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', $type, $recurse, $full); + } + } + elseif (StringHelper::check($fileTypes)) + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', $fileTypes, $recurse, $full); + } + else + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', '.', $recurse, $full); + } + + // change back to Joomla working directory + chdir($joomla); + + // return array of files + return array_map( fn($file) => str_replace('./', '/', (string) $file), (array) ArrayHelper::merge($files)); + } + return null; + } + + /** + * 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 + */ + 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)) + { + $default = JPATH_SITE . '/images/'; + } + + // get the global settings + $filePath = Helper::getParams()->get($target, $default); + + // check the file path (revert to default only of not a hidden file path) + if ('hiddenfilepath' !== $target && strpos((string) $filePath, (string) JPATH_SITE) === false) + { + $filePath = $default; + } + + // create the folder if it does not exist + if ($createIfNotSet && !Folder::exists($filePath)) + { + Folder::create($filePath); + } + + // setup the file name + $fileName = ''; + + // Get basic key + $basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug'; + // get the component helper + $helper = Helper::get(); + // check if method exist in helper class + if ($helper && Helper::methodExists('getCryptKey')) + { + $basickey = $helper::getCryptKey('basic', $basickey); + } + + // check the key + if (!StringHelper::check($key)) + { + $key = 'vDm'; + } + + // set the file name + if (StringHelper::check($fileType)) + { + // set the name + $fileName = trim( md5($type . $target . $basickey . $key) . '.' . trim($fileType, '.')); + } + else + { + $fileName = trim( md5($type . $target . $basickey . $key)) . '.txt'; + } + + // return the url + if ('url' === $type) + { + if (\strpos((string) $filePath, (string) JPATH_SITE) !== false) + { + $filePath = trim( str_replace( JPATH_SITE, '', (string) $filePath), '/'); + + return Uri::root() . $filePath . '/' . $fileName; + } + + // since the path is behind the root folder of the site, return only the root url (may be used to build the link) + return Uri::root(); + } + + // sanitize the path + return '/' . trim((string) $filePath, '/' ) . '/' . $fileName; + } + + /** + * Check if file exist + * + * @param string $path The url/path to check + * + * @return bool If exist true + * + * @since 3.0.9 + */ + public static function exists($path): bool + { + $exists = false; + // if this is a local path + if (strpos($path, 'http:') === false && strpos($path, 'https:') === false) + { + if (file_exists($path)) + { + $exists = true; + } + } + // check if we can use curl + elseif (function_exists('curl_version')) + { + // initiate curl + $ch = curl_init($path); + // CURLOPT_NOBODY (do not return body) + curl_setopt($ch, CURLOPT_NOBODY, true); + // make call + $result = curl_exec($ch); + // check return value + if ($result !== false) + { + // get the http CODE + $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + if ($statusCode !== 404) + { + $exists = true; + } + } + // close the connection + curl_close($ch); + } + elseif ($headers = @get_headers($path)) + { + if(isset($headers[0]) && is_string($headers[0]) && strpos($headers[0],'404') === false) + { + $exists = true; + } + } + return $exists; + } diff --git a/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/settings.json b/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/settings.json index 6b3b222..792b263 100644 --- a/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/settings.json +++ b/src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/settings.json @@ -1 +1,33 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "0", + "guid": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0", + "implements": null, + "load_selection": { + "load_selection0": { + "load": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a" + }, + "load_selection1": { + "load": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef" + }, + "load_selection2": { + "load": "91004529-94a9-4590-b842-e7c6b624ecf5" + } + }, + "name": "FileHelper", + "power_version": "1.0.0", + "system_name": "Utilities FileHelper", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "640b5352-fb09-425f-a26e-cd44eda03f15", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Utilities.FileHelper", + "description": "File helper\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 \r\n * @git 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\\CMS\\Uri\\Uri;\r\nuse Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\Language\\Text;\r\nuse Joomla\\CMS\\Filesystem\\Path;\r\nuse Joomla\\CMS\\Filesystem\\File;\r\nuse Joomla\\CMS\\Filesystem\\Folder;\r\nuse Joomla\\Archive\\Archive;", + "composer": "" +} \ No newline at end of file diff --git a/src/a8935cbe-7701-40dc-bfd5-675f2d600954/README.md b/src/a8935cbe-7701-40dc-bfd5-675f2d600954/README.md index 433b69e..c5244ed 100644 --- a/src/a8935cbe-7701-40dc-bfd5-675f2d600954/README.md +++ b/src/a8935cbe-7701-40dc-bfd5-675f2d600954/README.md @@ -1 +1,37 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class TypeHelper (Details) +> namespace: **VDM\Joomla\Utilities\String** +```uml +@startuml +abstract TypeHelper #Orange { + # static $builder + + {static} safe(String $string, String $option = null) +} + +note right of TypeHelper::safe + Making field type name safe + + since: 3.0.9 +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.php b/src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.php index b9a864e..3c1554d 100644 --- a/src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.php +++ b/src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.php @@ -9,4 +9,74 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities\String; + + +use Joomla\CMS\Component\ComponentHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\Component\Helper; + + +/** + * Control the naming of a field type + * + * @since 3.0.9 + */ +abstract class TypeHelper +{ + /** + * The field builder switch + * + * @since 3.0.9 + */ + protected static $builder = false; + + /** + * Making field type name safe + * + * @param String $string The you would like to make safe + * @param String $option The option for the component. + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($string, $option = null) + { + // get global value + if (self::$builder === false) + { + self::$builder = Helper::getParams($option)->get('type_name_builder', 1); + } + + // use the new convention + if (2 == self::$builder) + { + // 0nly continue if we have a string + if (StringHelper::check($string)) + { + // check that the first character is not a number + if (is_numeric(substr($string, 0, 1))) + { + $string = StringHelper::numbers($string); + } + + // Transliterate string + $string = StringHelper::transliterate($string); + + // remove all and keep only characters and numbers and point (TODO just one point) + $string = trim(preg_replace("/[^A-Za-z0-9_\.]/", '', (string) $string)); + + // best is to return lower (for all string equality in compiler) + return strtolower($string); + } + // not a string + return ''; + } + + // use the default (original behaviour/convention) + return StringHelper::safe($string); + } + +} + diff --git a/src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.power b/src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.power index 69309b0..3f19db7 100644 --- a/src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.power +++ b/src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.power @@ -1 +1,53 @@ -###CODEPOWER### \ No newline at end of file + /** + * The field builder switch + * + * @since 3.0.9 + */ + protected static $builder = false; + + /** + * Making field type name safe + * + * @param String $string The you would like to make safe + * @param String $option The option for the component. + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($string, $option = null) + { + // get global value + if (self::$builder === false) + { + self::$builder = Helper::getParams($option)->get('type_name_builder', 1); + } + + // use the new convention + if (2 == self::$builder) + { + // 0nly continue if we have a string + if (StringHelper::check($string)) + { + // check that the first character is not a number + if (is_numeric(substr($string, 0, 1))) + { + $string = StringHelper::numbers($string); + } + + // Transliterate string + $string = StringHelper::transliterate($string); + + // remove all and keep only characters and numbers and point (TODO just one point) + $string = trim(preg_replace("/[^A-Za-z0-9_\.]/", '', (string) $string)); + + // best is to return lower (for all string equality in compiler) + return strtolower($string); + } + // not a string + return ''; + } + + // use the default (original behaviour/convention) + return StringHelper::safe($string); + } diff --git a/src/a8935cbe-7701-40dc-bfd5-675f2d600954/settings.json b/src/a8935cbe-7701-40dc-bfd5-675f2d600954/settings.json index 6b3b222..457d8f2 100644 --- a/src/a8935cbe-7701-40dc-bfd5-675f2d600954/settings.json +++ b/src/a8935cbe-7701-40dc-bfd5-675f2d600954/settings.json @@ -1 +1,27 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "0", + "guid": "a8935cbe-7701-40dc-bfd5-675f2d600954", + "implements": null, + "load_selection": null, + "name": "TypeHelper", + "power_version": "1.0.0", + "system_name": "String Type Helper", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef", + "as": "default" + }, + "use_selection1": { + "use": "640b5352-fb09-425f-a26e-cd44eda03f15", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Utilities.String.TypeHelper", + "description": "Control the naming of a field type\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 \r\n * @git 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\\CMS\\Component\\ComponentHelper;", + "composer": "" +} \ No newline at end of file diff --git a/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/README.md b/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/README.md index 433b69e..de7ddb4 100644 --- a/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/README.md +++ b/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/README.md @@ -1 +1,79 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# interface InsertInterface (Details) +> namespace: **VDM\Joomla\Interfaces** +```uml +@startuml +interface InsertInterface #Lavender { + + defaults(bool $trigger = true) : void + + rows(array $data, string $table, ...) : bool + + items(array $data, string $table, ...) : bool + + row(array $data, string $table) : bool + + item(object $data, string $table) : bool +} + +note right of InsertInterface::defaults + Switch to prevent/allow defaults from being added. + + since: 3.2.0 + return: void +end note + +note right of InsertInterface::rows + Insert rows to the database (with remapping and filtering columns option) + + since: 3.2.0 + return: bool + + arguments: + array $data + string $table + array $columns = [] +end note + +note right of InsertInterface::items + Insert items to the database (with remapping and filtering columns option) + + since: 3.2.0 + return: bool + + arguments: + array $data + string $table + array $columns = [] +end note + +note right of InsertInterface::row + Insert row to the database + + since: 3.2.0 + return: bool +end note + +note right of InsertInterface::item + Insert item to the database + + since: 3.2.0 + return: bool +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.php b/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.php index 26c1a50..c76b97b 100644 --- a/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.php +++ b/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.php @@ -9,4 +9,70 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Interfaces; + + +/** + * Database Insert Interface + * + * @since 3.2.0 + */ +interface InsertInterface +{ + /** + * Switch to prevent/allow defaults from being added. + * + * @param bool $trigger toggle the defaults + * + * @return void + * @since 3.2.0 + **/ + public function defaults(bool $trigger = true); + + /** + * Insert rows to the database (with remapping and filtering columns option) + * + * @param array $data Dataset to store in database [array of arrays (key => value)] + * @param string $table The table where the data is being added + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function rows(array $data, string $table, array $columns = []): bool; + + /** + * Insert items to the database (with remapping and filtering columns option) + * + * @param array $data Data to store in database (array of objects) + * @param string $table The table where the data is being added + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function items(array $data, string $table, array $columns = []): bool; + + /** + * Insert row to the database + * + * @param array $data Dataset to store in database (key => value) + * @param string $table The table where the data is being added + * + * @return bool + * @since 3.2.0 + **/ + public function row(array $data, string $table): bool; + + /** + * Insert item to the database + * + * @param object $data Dataset to store in database (key => value) + * @param string $table The table where the data is being added + * + * @return bool + * @since 3.2.0 + **/ + public function item(object $data, string $table): bool; +} + diff --git a/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.power b/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.power index 69309b0..c4b405a 100644 --- a/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.power +++ b/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.power @@ -1 +1,55 @@ -###CODEPOWER### \ No newline at end of file + /** + * Switch to prevent/allow defaults from being added. + * + * @param bool $trigger toggle the defaults + * + * @return void + * @since 3.2.0 + **/ + public function defaults(bool $trigger = true); + + /** + * Insert rows to the database (with remapping and filtering columns option) + * + * @param array $data Dataset to store in database [array of arrays (key => value)] + * @param string $table The table where the data is being added + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function rows(array $data, string $table, array $columns = []): bool; + + /** + * Insert items to the database (with remapping and filtering columns option) + * + * @param array $data Data to store in database (array of objects) + * @param string $table The table where the data is being added + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function items(array $data, string $table, array $columns = []): bool; + + /** + * Insert row to the database + * + * @param array $data Dataset to store in database (key => value) + * @param string $table The table where the data is being added + * + * @return bool + * @since 3.2.0 + **/ + public function row(array $data, string $table): bool; + + /** + * Insert item to the database + * + * @param object $data Dataset to store in database (key => value) + * @param string $table The table where the data is being added + * + * @return bool + * @since 3.2.0 + **/ + public function item(object $data, string $table): bool; \ No newline at end of file diff --git a/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/settings.json b/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/settings.json index 6b3b222..411643b 100644 --- a/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/settings.json +++ b/src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48", + "implements": null, + "load_selection": null, + "name": "InsertInterface", + "power_version": "1.0.0", + "system_name": "VDM.Interfaces.InsertInterface", + "type": "interface", + "use_selection": null, + "namespace": "VDM\\Joomla\\Interfaces.InsertInterface", + "description": "Database Insert Interface\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/af0eedbe-603b-4671-8e5a-28165d88254b/README.md b/src/af0eedbe-603b-4671-8e5a-28165d88254b/README.md index 433b69e..aa6cba1 100644 --- a/src/af0eedbe-603b-4671-8e5a-28165d88254b/README.md +++ b/src/af0eedbe-603b-4671-8e5a-28165d88254b/README.md @@ -1 +1,93 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# interface Activeregistryinterface (Details) +> namespace: **VDM\Joomla\Interfaces** +```uml +@startuml +interface Activeregistryinterface #Lavender { + + isActive() : bool + + allActive() : array + + setActive(mixed $value, $keys) : void + + addActive(mixed $value, ?bool $asArray, ...) : void + + getActive(mixed $default, $keys) : mixed + + removeActive($keys) : void + + existsActive($keys) : bool +} + +note right of Activeregistryinterface::isActive + Check if the registry has any content. + + since: 3.2.0 + return: bool +end note + +note right of Activeregistryinterface::allActive + Retrieves all value from the registry. + + since: 3.2.0 + return: array +end note + +note right of Activeregistryinterface::setActive + Sets a value into the registry using multiple keys. + + since: 3.2.0 + return: void +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 + $keys +end note + +note right of Activeregistryinterface::getActive + Retrieves a value (or sub-array) from the registry using multiple keys. + + since: 3.2.0 + return: mixed +end note + +note right of Activeregistryinterface::removeActive + Removes a value (or sub-array) from the registry using multiple keys. + + since: 3.2.0 + return: void +end note + +note right of Activeregistryinterface::existsActive + Checks the existence of a particular location in the registry using multiple keys. + + since: 3.2.0 + return: bool +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/af0eedbe-603b-4671-8e5a-28165d88254b/code.php b/src/af0eedbe-603b-4671-8e5a-28165d88254b/code.php index 26c1a50..ebf3a67 100644 --- a/src/af0eedbe-603b-4671-8e5a-28165d88254b/code.php +++ b/src/af0eedbe-603b-4671-8e5a-28165d88254b/code.php @@ -9,4 +9,92 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Interfaces; + + +/** + * The Active Registry Interface + * + * @since 3.2.0 + */ +interface Activeregistryinterface +{ + /** + * Check if the registry has any content. + * + * @return bool Returns true if the active array is not empty, false otherwise. + * @since 3.2.0 + */ + public function isActive(): bool; + + /** + * Retrieves all value from the registry. + * + * @return array The values. + * @since 3.2.0 + */ + public function allActive(): array; + + /** + * Sets a value into the registry using multiple keys. + * + * @param mixed $value The value to set. + * @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 setActive($value, string ...$keys): void; + + /** + * 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|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; + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param mixed $default The default value if not set. + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function getActive($default, string ...$keys); + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @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 removeActive(string ...$keys): void; + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function existsActive(string ...$keys): bool; +} + diff --git a/src/af0eedbe-603b-4671-8e5a-28165d88254b/code.power b/src/af0eedbe-603b-4671-8e5a-28165d88254b/code.power index 69309b0..3ffd837 100644 --- a/src/af0eedbe-603b-4671-8e5a-28165d88254b/code.power +++ b/src/af0eedbe-603b-4671-8e5a-28165d88254b/code.power @@ -1 +1,77 @@ -###CODEPOWER### \ No newline at end of file + /** + * Check if the registry has any content. + * + * @return bool Returns true if the active array is not empty, false otherwise. + * @since 3.2.0 + */ + public function isActive(): bool; + + /** + * Retrieves all value from the registry. + * + * @return array The values. + * @since 3.2.0 + */ + public function allActive(): array; + + /** + * Sets a value into the registry using multiple keys. + * + * @param mixed $value The value to set. + * @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 setActive($value, string ...$keys): void; + + /** + * 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|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; + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param mixed $default The default value if not set. + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function getActive($default, string ...$keys); + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @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 removeActive(string ...$keys): void; + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function existsActive(string ...$keys): bool; \ No newline at end of file diff --git a/src/af0eedbe-603b-4671-8e5a-28165d88254b/settings.json b/src/af0eedbe-603b-4671-8e5a-28165d88254b/settings.json index 6b3b222..56b116a 100644 --- a/src/af0eedbe-603b-4671-8e5a-28165d88254b/settings.json +++ b/src/af0eedbe-603b-4671-8e5a-28165d88254b/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "af0eedbe-603b-4671-8e5a-28165d88254b", + "implements": null, + "load_selection": null, + "name": "Activeregistryinterface", + "power_version": "1.0.0", + "system_name": "VDM.Interfaces.Activeregistryinterface", + "type": "interface", + "use_selection": null, + "namespace": "VDM\\Joomla\\Interfaces.Activeregistryinterface", + "description": "The Active Registry Interface\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/README.md b/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/README.md index 433b69e..a4801d0 100644 --- a/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/README.md +++ b/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/README.md @@ -1 +1,70 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class BaseRegistry (Details) +> namespace: **VDM\Joomla\Componentbuilder\Abstraction** +> extends: **JoomlaRegistry** +```uml +@startuml +abstract BaseRegistry #Orange { + + _(string $path) : ?\ArrayIterator + + appendArray(string $path, mixed $value) : mixed + + isArray(string $path) : bool + + isString(string $path) : bool + + isNumeric(string $path) : bool +} + +note right of BaseRegistry::_ + Method to iterate over any part of the registry + + since: 3.4.0 + return: ?\ArrayIterator +end note + +note right of BaseRegistry::appendArray + Append value to a path in registry of an array + + since: 3.2.0 + return: mixed +end note + +note right of BaseRegistry::isArray + Check if a registry path exists and is an array + + since: 3.2.0 + return: bool +end note + +note right of BaseRegistry::isString + Check if a registry path exists and is a string + + since: 3.2.0 + return: bool +end note + +note right of BaseRegistry::isNumeric + Check if a registry path exists and is numeric + + since: 3.2.0 + return: bool +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.php b/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.php index 26c1a50..bfec409 100644 --- a/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.php +++ b/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.php @@ -9,4 +9,142 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Componentbuilder\Abstraction; + + +use Joomla\Registry\Registry as JoomlaRegistry; + + +/** + * Registry + * + * So we have full control over this class + * + * @since 3.2.0 + */ +abstract class BaseRegistry extends JoomlaRegistry implements \JsonSerializable, \ArrayAccess, \IteratorAggregate, \Countable +{ + /** + * Method to iterate over any part of the registry + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return \ArrayIterator|null This object represented as an ArrayIterator. + * + * @since 3.4.0 + */ + public function _(string $path): ?\ArrayIterator + { + $data = $this->extract($path); + + if ($data === null) + { + return null; + } + + return $data->getIterator(); + } + + /** + * Append value to a path in registry of an array + * + * @param string $path Parent registry Path (e.g. joomla.content.showauthor) + * @param mixed $value Value of entry + * + * @return mixed The value of the that has been set. + * + * @since 3.2.0 + */ + public function appendArray(string $path, $value) + { + // check if it does not exist + if (!$this->exists($path)) + { + $this->set($path, []); + } + + return $this->append($path, $value); + } + + /** + * Check if a registry path exists and is an array + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return boolean + * + * @since 3.2.0 + */ + public function isArray(string $path): bool + { + // Return default value if path is empty + if (empty($path)) { + return false; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_array($node) + && $node !== []) + { + return true; + } + + return false; + } + + /** + * Check if a registry path exists and is a string + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return boolean + * + * @since 3.2.0 + */ + public function isString(string $path): bool + { + // Return default value if path is empty + if (empty($path)) { + return false; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_string($node) + && strlen((string) $node) > 0) + { + return true; + } + + return false; + } + + /** + * Check if a registry path exists and is numeric + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return boolean + * + * @since 3.2.0 + */ + public function isNumeric(string $path): bool + { + // Return default value if path is empty + if (empty($path)) { + return false; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_numeric($node)) + { + return true; + } + + return false; + } + +} + diff --git a/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.power b/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.power index 69309b0..cec5eb4 100644 --- a/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.power +++ b/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.power @@ -1 +1,121 @@ -###CODEPOWER### \ No newline at end of file + /** + * Method to iterate over any part of the registry + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return \ArrayIterator|null This object represented as an ArrayIterator. + * + * @since 3.4.0 + */ + public function _(string $path): ?\ArrayIterator + { + $data = $this->extract($path); + + if ($data === null) + { + return null; + } + + return $data->getIterator(); + } + + /** + * Append value to a path in registry of an array + * + * @param string $path Parent registry Path (e.g. joomla.content.showauthor) + * @param mixed $value Value of entry + * + * @return mixed The value of the that has been set. + * + * @since 3.2.0 + */ + public function appendArray(string $path, $value) + { + // check if it does not exist + if (!$this->exists($path)) + { + $this->set($path, []); + } + + return $this->append($path, $value); + } + + /** + * Check if a registry path exists and is an array + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return boolean + * + * @since 3.2.0 + */ + public function isArray(string $path): bool + { + // Return default value if path is empty + if (empty($path)) { + return false; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_array($node) + && $node !== []) + { + return true; + } + + return false; + } + + /** + * Check if a registry path exists and is a string + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return boolean + * + * @since 3.2.0 + */ + public function isString(string $path): bool + { + // Return default value if path is empty + if (empty($path)) { + return false; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_string($node) + && strlen((string) $node) > 0) + { + return true; + } + + return false; + } + + /** + * Check if a registry path exists and is numeric + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return boolean + * + * @since 3.2.0 + */ + public function isNumeric(string $path): bool + { + // Return default value if path is empty + if (empty($path)) { + return false; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_numeric($node)) + { + return true; + } + + return false; + } diff --git a/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/settings.json b/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/settings.json index 6b3b222..2ec0afd 100644 --- a/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/settings.json +++ b/src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/settings.json @@ -1 +1,22 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "-1", + "guid": "b84e947d-2a13-44f7-ac0f-3902ae55ae0c", + "implements": [ + "-1" + ], + "load_selection": null, + "name": "BaseRegistry", + "power_version": "1.0.0", + "system_name": "JCB.Abstraction.BaseRegistry", + "type": "abstract class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Componentbuilder.Abstraction.BaseRegistry", + "description": "Registry\r\n\r\nSo we have full control over this class\r\n\r\n@since 3.2.0", + "implements_custom": "\\JsonSerializable, \\ArrayAccess, \\IteratorAggregate, \\Countable", + "extends_custom": "JoomlaRegistry", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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\\Registry\\Registry as JoomlaRegistry;", + "composer": "" +} \ No newline at end of file diff --git a/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/README.md b/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/README.md index 433b69e..8215d1d 100644 --- a/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/README.md +++ b/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/README.md @@ -1 +1,30 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# class Table (Details) +> namespace: **VDM\Joomla\Componentbuilder** +> extends: **BaseTable** +```uml +@startuml +class Table #Gold { +} + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.php b/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.php index 26c1a50..a69d9af 100644 --- a/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.php +++ b/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.php @@ -9,4 +9,5687 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Componentbuilder; + + +use VDM\Joomla\Interfaces\Tableinterface; +use VDM\Joomla\Abstraction\BaseTable; + + +/** + * JCB Tables + * + * @since 3.2.0 + */ +class Table extends BaseTable implements Tableinterface +{ + /** + * All areas/views/tables with their field details + * + * @var array + * @since 3.2.0 + **/ + protected array $tables = [ + 'joomla_component' => [ + 'system_name' => [ + 'name' => 'system_name', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SYSTEM_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'name_code' => [ + 'name' => 'name_code', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'short_description' => [ + 'name' => 'short_description', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SHORT_DESCRIPTION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'companyname' => [ + 'name' => 'companyname', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'buildcompsql' => [ + 'name' => 'buildcompsql', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDCOMPSQL_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Dynamic Build (beta)', + ], + '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', + ], + '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_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', + ], + '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', + ], + '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', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + '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', + ], + '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', + ], + 'php_site_event' => [ + 'name' => 'php_site_event', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_SITE_EVENT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Libs & Helpers', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'author' => [ + 'name' => 'author', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + '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', + ], + 'email' => [ + 'name' => 'email', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMAIL_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + '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', + ], + 'website' => [ + 'name' => 'website', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_LABEL', + 'type' => 'url', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'add_license' => [ + 'name' => 'add_license', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_LICENSE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + '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' => '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', + ], + 'license_type' => [ + 'name' => 'license_type', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_TYPE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'joomla_components', + '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', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Libs & Helpers', + ], + 'php_helper_site' => [ + 'name' => 'php_helper_site', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_SITE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Libs & Helpers', + ], + 'whmcs_key' => [ + 'name' => 'whmcs_key', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_KEY_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'basic_encryption', + 'tab_name' => 'Details', + ], + 'javascript' => [ + 'name' => 'javascript', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Libs & Helpers', + ], + 'whmcs_url' => [ + 'name' => 'whmcs_url', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_URL_LABEL', + 'type' => 'url', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'css_site' => [ + 'name' => 'css_site', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_SITE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Libs & Helpers', + ], + 'whmcs_buy_link' => [ + 'name' => 'whmcs_buy_link', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_BUY_LINK_LABEL', + 'type' => 'url', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'license' => [ + 'name' => 'license', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'php_preflight_update' => [ + 'name' => 'php_preflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Dash & Install', + ], + 'bom' => [ + 'name' => 'bom', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BOM_LABEL', + 'type' => 'filelist', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'php_postflight_update' => [ + 'name' => 'php_postflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_UPDATE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Dash & Install', + ], + 'image' => [ + 'name' => 'image', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE_LABEL', + 'type' => 'media', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'sql' => [ + 'name' => 'sql', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'MySQL', + ], + 'copyright' => [ + 'name' => 'copyright', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COPYRIGHT_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'addreadme' => [ + 'name' => 'addreadme', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDREADME_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Readme', + ], + 'preferred_joomla_version' => [ + 'name' => 'preferred_joomla_version', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PREFERRED_JOOMLA_VERSION_LABEL', + 'type' => 'number', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'update_server_url' => [ + 'name' => 'update_server_url', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_LABEL', + 'type' => 'url', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'add_powers' => [ + 'name' => 'add_powers', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_POWERS_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'add_backup_folder_path' => [ + 'name' => 'add_backup_folder_path', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_BACKUP_FOLDER_PATH_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'crowdin_project_identifier' => [ + 'name' => 'crowdin_project_identifier', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_IDENTIFIER_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'created' => [ + 'name' => 'created', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CREATED_LABEL', + 'type' => 'calendar', + 'title' => false, + 'list' => 'joomla_components', + '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', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Libs & Helpers', + ], + 'add_admin_event' => [ + 'name' => 'add_admin_event', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_ADMIN_EVENT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Libs & Helpers', + ], + 'add_php_helper_site' => [ + 'name' => 'add_php_helper_site', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_SITE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Libs & Helpers', + ], + 'add_site_event' => [ + 'name' => 'add_site_event', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SITE_EVENT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + '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', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + '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', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Settings', + ], + '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', + ], + 'menu_prefix' => [ + 'name' => 'menu_prefix', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MENU_PREFIX_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Settings', + ], + 'dashboard' => [ + 'name' => 'dashboard', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DASHBOARD_LABEL', + 'type' => 'dynamicdashboard', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Dash & Install', + ], + 'add_php_preflight_install' => [ + 'name' => 'add_php_preflight_install', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_PREFLIGHT_INSTALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Dash & Install', + ], + 'add_php_preflight_update' => [ + 'name' => 'add_php_preflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_PREFLIGHT_UPDATE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + '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', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + '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', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'basic_encryption', + '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', + ], + 'joomla_source_link' => [ + 'name' => 'joomla_source_link', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JOOMLA_SOURCE_LINK_LABEL', + 'type' => 'url', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Settings', + ], + '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', + ], + 'export_buy_link' => [ + 'name' => 'export_buy_link', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_BUY_LINK_LABEL', + 'type' => 'url', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Settings', + ], + 'assets_table_fix' => [ + 'name' => 'assets_table_fix', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ASSETS_TABLE_FIX_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'MySQL', + ], + 'readme' => [ + 'name' => 'readme', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_README_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'base64', + 'tab_name' => 'Readme', + ], + 'add_update_server' => [ + 'name' => 'add_update_server', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UPDATE_SERVER_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'addcontributors' => [ + 'name' => 'addcontributors', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDCONTRIBUTORS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'json', + 'tab_name' => 'Settings', + ], + 'update_server_target' => [ + 'name' => 'update_server_target', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_TARGET_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + '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', + 'type' => 'servers', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'sales_server' => [ + 'name' => 'sales_server', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SALES_SERVER_LABEL', + 'type' => 'servers', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'add_git_folder_path' => [ + 'name' => 'add_git_folder_path', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_GIT_FOLDER_PATH_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'git_folder_path' => [ + 'name' => 'git_folder_path', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_GIT_FOLDER_PATH_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'crowdin_project_api_key' => [ + 'name' => 'crowdin_project_api_key', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_API_KEY_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'basic_encryption', + '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', + ], + 'crowdin_account_api_key' => [ + 'name' => 'crowdin_account_api_key', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_ACCOUNT_API_KEY_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => 'basic_encryption', + 'tab_name' => 'Dynamic Integration', + ], + 'adduikit' => [ + 'name' => 'adduikit', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDUIKIT_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Libs & Helpers', + ], + 'buildcomp' => [ + 'name' => 'buildcomp', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDCOMP_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Dynamic Build (beta)', + ], + 'addfootable' => [ + 'name' => 'addfootable', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDFOOTABLE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Libs & Helpers', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'add_email_helper' => [ + 'name' => 'add_email_helper', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Libs & Helpers', + ], + 'modified' => [ + 'name' => 'modified', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MODIFIED_LABEL', + 'type' => 'calendar', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_components', + 'store' => NULL, + 'tab_name' => 'Details', + ], + ], + 'joomla_module' => [ + 'system_name' => [ + 'name' => 'system_name', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_SYSTEM_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'HTML', + ], + 'target' => [ + 'name' => 'target', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_TARGET_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'HTML', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_DESCRIPTION_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'HTML', + ], + 'add_php_method_uninstall' => [ + 'name' => 'add_php_method_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_METHOD_UNINSTALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'add_php_postflight_update' => [ + 'name' => 'add_php_postflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_POSTFLIGHT_UPDATE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'add_php_postflight_install' => [ + 'name' => 'add_php_postflight_install', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_POSTFLIGHT_INSTALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'add_php_preflight_uninstall' => [ + 'name' => 'add_php_preflight_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_PREFLIGHT_UNINSTALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'addreadme' => [ + 'name' => 'addreadme', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDREADME_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Readme', + ], + 'default' => [ + 'name' => 'default', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_DEFAULT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'HTML', + ], + 'snippet' => [ + 'name' => 'snippet', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_SNIPPET_LABEL', + 'type' => 'snippets', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'HTML', + ], + 'add_sql' => [ + 'name' => 'add_sql', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_SQL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'MySQL', + ], + 'update_server_target' => [ + 'name' => 'update_server_target', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATE_SERVER_TARGET_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'add_sql_uninstall' => [ + 'name' => 'add_sql_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_SQL_UNINSTALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'MySQL', + ], + 'update_server' => [ + 'name' => 'update_server', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATE_SERVER_LABEL', + 'type' => 'servers', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'add_update_server' => [ + 'name' => 'add_update_server', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_UPDATE_SERVER_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'libraries' => [ + 'name' => 'libraries', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_LIBRARIES_LABEL', + 'type' => 'libraries', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'json', + 'tab_name' => 'HTML', + ], + 'module_version' => [ + 'name' => 'module_version', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_MODULE_VERSION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'HTML', + ], + 'sales_server' => [ + 'name' => 'sales_server', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_SALES_SERVER_LABEL', + 'type' => 'servers', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'custom_get' => [ + 'name' => 'custom_get', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_CUSTOM_GET_LABEL', + 'type' => 'customgets', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'json', + 'tab_name' => 'Code', + ], + 'php_preflight_update' => [ + 'name' => 'php_preflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_UPDATE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'php_preflight_uninstall' => [ + 'name' => 'php_preflight_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_UNINSTALL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'mod_code' => [ + 'name' => 'mod_code', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_MOD_CODE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'Code', + ], + 'php_postflight_install' => [ + 'name' => 'php_postflight_install', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_POSTFLIGHT_INSTALL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'add_class_helper' => [ + 'name' => 'add_class_helper', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Helper', + ], + 'php_postflight_update' => [ + 'name' => 'php_postflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_POSTFLIGHT_UPDATE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'add_class_helper_header' => [ + 'name' => 'add_class_helper_header', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Helper', + ], + 'php_method_uninstall' => [ + 'name' => 'php_method_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_METHOD_UNINSTALL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'class_helper_header' => [ + 'name' => 'class_helper_header', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_CLASS_HELPER_HEADER_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'Helper', + ], + 'sql' => [ + 'name' => 'sql', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_SQL_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'MySQL', + ], + 'class_helper_code' => [ + 'name' => 'class_helper_code', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_CLASS_HELPER_CODE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'Helper', + ], + 'sql_uninstall' => [ + 'name' => 'sql_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_SQL_UNINSTALL_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'MySQL', + ], + 'fields' => [ + 'name' => 'fields', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_FIELDS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'json', + 'tab_name' => 'Forms & Fields', + ], + 'readme' => [ + 'name' => 'readme', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_README_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'Readme', + ], + 'add_php_script_construct' => [ + 'name' => 'add_php_script_construct', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_SCRIPT_CONSTRUCT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'update_server_url' => [ + 'name' => 'update_server_url', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATE_SERVER_URL_LABEL', + 'type' => 'url', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'php_script_construct' => [ + 'name' => 'php_script_construct', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_SCRIPT_CONSTRUCT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'add_php_preflight_install' => [ + 'name' => 'add_php_preflight_install', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_PREFLIGHT_INSTALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'php_preflight_install' => [ + 'name' => 'php_preflight_install', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_PREFLIGHT_INSTALL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'add_sales_server' => [ + 'name' => 'add_sales_server', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_SALES_SERVER_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'add_php_preflight_update' => [ + 'name' => 'add_php_preflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_PREFLIGHT_UPDATE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_modules', + 'store' => NULL, + 'tab_name' => 'HTML', + ], + ], + 'joomla_plugin' => [ + 'system_name' => [ + 'name' => 'system_name', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SYSTEM_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'class_extends' => [ + 'name' => 'class_extends', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS_LABEL', + 'type' => 'classextends', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'joomla_plugin_group' => [ + 'name' => 'joomla_plugin_group', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_JOOMLA_PLUGIN_GROUP_LABEL', + 'type' => 'joomlaplugingroups', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'add_sql' => [ + 'name' => 'add_sql', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_SQL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'MySQL', + ], + 'add_php_method_uninstall' => [ + 'name' => 'add_php_method_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_METHOD_UNINSTALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'add_php_postflight_update' => [ + 'name' => 'add_php_postflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_POSTFLIGHT_UPDATE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'add_php_postflight_install' => [ + 'name' => 'add_php_postflight_install', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_POSTFLIGHT_INSTALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'sales_server' => [ + 'name' => 'sales_server', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SALES_SERVER_LABEL', + 'type' => 'servers', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'add_update_server' => [ + 'name' => 'add_update_server', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_UPDATE_SERVER_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'method_selection' => [ + 'name' => 'method_selection', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_METHOD_SELECTION_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'json', + 'tab_name' => 'Code', + ], + 'property_selection' => [ + 'name' => 'property_selection', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTY_SELECTION_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'json', + 'tab_name' => 'Code', + ], + 'add_head' => [ + 'name' => 'add_head', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'add_sql_uninstall' => [ + 'name' => 'add_sql_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_SQL_UNINSTALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'MySQL', + ], + 'addreadme' => [ + 'name' => 'addreadme', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDREADME_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Readme', + ], + 'head' => [ + 'name' => 'head', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_HEAD_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'Code', + ], + 'update_server_target' => [ + 'name' => 'update_server_target', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_TARGET_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'main_class_code' => [ + 'name' => 'main_class_code', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_MAIN_CLASS_CODE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'Code', + ], + 'update_server' => [ + 'name' => 'update_server', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_LABEL', + 'type' => 'servers', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_DESCRIPTION_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'php_postflight_install' => [ + 'name' => 'php_postflight_install', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_INSTALL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'plugin_version' => [ + 'name' => 'plugin_version', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PLUGIN_VERSION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'php_postflight_update' => [ + 'name' => 'php_postflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_POSTFLIGHT_UPDATE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'fields' => [ + 'name' => 'fields', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FIELDS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'json', + 'tab_name' => 'Forms & Fields', + ], + 'php_method_uninstall' => [ + 'name' => 'php_method_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_METHOD_UNINSTALL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'add_php_script_construct' => [ + 'name' => 'add_php_script_construct', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_SCRIPT_CONSTRUCT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'sql' => [ + 'name' => 'sql', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SQL_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'MySQL', + ], + 'php_script_construct' => [ + 'name' => 'php_script_construct', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_SCRIPT_CONSTRUCT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'sql_uninstall' => [ + 'name' => 'sql_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SQL_UNINSTALL_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'MySQL', + ], + 'add_php_preflight_install' => [ + 'name' => 'add_php_preflight_install', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_INSTALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'readme' => [ + 'name' => 'readme', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_README_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'Readme', + ], + 'php_preflight_install' => [ + 'name' => 'php_preflight_install', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_INSTALL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'update_server_url' => [ + 'name' => 'update_server_url', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATE_SERVER_URL_LABEL', + 'type' => 'url', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'add_php_preflight_update' => [ + 'name' => 'add_php_preflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_UPDATE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'php_preflight_update' => [ + 'name' => 'php_preflight_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UPDATE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'add_php_preflight_uninstall' => [ + 'name' => 'add_php_preflight_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_PREFLIGHT_UNINSTALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Script File', + ], + 'add_sales_server' => [ + 'name' => 'add_sales_server', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_SALES_SERVER_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Dynamic Integration', + ], + 'php_preflight_uninstall' => [ + 'name' => 'php_preflight_uninstall', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_PREFLIGHT_UNINSTALL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => 'base64', + 'tab_name' => 'Script File', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'joomla_plugins', + 'store' => NULL, + 'tab_name' => 'Code', + ], + ], + 'power' => [ + 'system_name' => [ + 'name' => 'system_name', + 'label' => 'COM_COMPONENTBUILDER_POWER_SYSTEM_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'namespace' => [ + 'name' => 'namespace', + 'label' => 'COM_COMPONENTBUILDER_POWER_NAMESPACE_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'type' => [ + 'name' => 'type', + 'label' => 'COM_COMPONENTBUILDER_POWER_TYPE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'power_version' => [ + 'name' => 'power_version', + 'label' => 'COM_COMPONENTBUILDER_POWER_POWER_VERSION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'method_selection' => [ + 'name' => 'method_selection', + 'label' => 'COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'powers', + 'store' => 'json', + 'tab_name' => 'Code', + ], + 'load_selection' => [ + 'name' => 'load_selection', + 'label' => 'COM_COMPONENTBUILDER_POWER_LOAD_SELECTION_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'powers', + 'store' => 'json', + 'tab_name' => 'Code', + ], + 'licensing_template' => [ + 'name' => 'licensing_template', + 'label' => 'COM_COMPONENTBUILDER_POWER_LICENSING_TEMPLATE_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'powers', + 'store' => 'base64', + 'tab_name' => 'Licensing', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_POWER_DESCRIPTION_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'composer' => [ + 'name' => 'composer', + 'label' => 'COM_COMPONENTBUILDER_POWER_COMPOSER_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'powers', + 'store' => 'json', + 'tab_name' => 'Composer', + ], + 'extends' => [ + 'name' => 'extends', + 'label' => 'COM_COMPONENTBUILDER_POWER_EXTENDS_LABEL', + 'type' => 'classpowers', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'approved' => [ + 'name' => 'approved', + 'label' => 'COM_COMPONENTBUILDER_POWER_APPROVED_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Super Power', + ], + 'property_selection' => [ + 'name' => 'property_selection', + 'label' => 'COM_COMPONENTBUILDER_POWER_PROPERTY_SELECTION_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'powers', + 'store' => 'json', + 'tab_name' => 'Code', + ], + 'add_head' => [ + 'name' => 'add_head', + 'label' => 'COM_COMPONENTBUILDER_POWER_ADD_HEAD_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'extends_custom' => [ + 'name' => 'extends_custom', + 'label' => 'COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'implements_custom' => [ + 'name' => 'implements_custom', + 'label' => 'COM_COMPONENTBUILDER_POWER_IMPLEMENTS_CUSTOM_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Code', + ], + 'implements' => [ + 'name' => 'implements', + 'label' => 'COM_COMPONENTBUILDER_POWER_IMPLEMENTS_LABEL', + 'type' => 'interfacepowers', + 'title' => false, + 'list' => 'powers', + 'store' => 'json', + 'tab_name' => 'Code', + ], + 'head' => [ + 'name' => 'head', + 'label' => 'COM_COMPONENTBUILDER_POWER_HEAD_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'powers', + 'store' => 'base64', + 'tab_name' => 'Code', + ], + 'approved_paths' => [ + 'name' => 'approved_paths', + 'label' => 'COM_COMPONENTBUILDER_POWER_APPROVED_PATHS_LABEL', + 'type' => 'superpowerpaths', + 'title' => false, + 'list' => 'powers', + 'store' => 'json', + 'tab_name' => 'Super Power', + ], + 'use_selection' => [ + 'name' => 'use_selection', + 'label' => 'COM_COMPONENTBUILDER_POWER_USE_SELECTION_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'powers', + 'store' => 'json', + 'tab_name' => 'Code', + ], + 'main_class_code' => [ + 'name' => 'main_class_code', + 'label' => 'COM_COMPONENTBUILDER_POWER_MAIN_CLASS_CODE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'powers', + 'store' => 'base64', + 'tab_name' => 'Code', + ], + 'add_licensing_template' => [ + 'name' => 'add_licensing_template', + 'label' => 'COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Licensing', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_POWER_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_POWER_NAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'powers', + 'store' => NULL, + 'tab_name' => 'Code', + ], + ], + 'admin_view' => [ + 'system_name' => [ + 'name' => 'system_name', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_SYSTEM_NAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'name_single' => [ + 'name' => 'name_single', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'short_description' => [ + 'name' => 'short_description', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_SHORT_DESCRIPTION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'php_allowedit' => [ + 'name' => 'php_allowedit', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_ALLOWEDIT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_postsavehook' => [ + 'name' => 'php_postsavehook', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_POSTSAVEHOOK_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_before_save' => [ + 'name' => 'php_before_save', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_BEFORE_SAVE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_getlistquery' => [ + 'name' => 'php_getlistquery', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETLISTQUERY_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_import_ext' => [ + 'name' => 'php_import_ext', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_EXT_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Import', + ], + 'icon' => [ + 'name' => 'icon', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ICON_LABEL', + 'type' => 'media', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'php_after_publish' => [ + 'name' => 'php_after_publish', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_AFTER_PUBLISH_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'add_fadein' => [ + 'name' => 'add_fadein', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_FADEIN_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_DESCRIPTION_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'icon_category' => [ + 'name' => 'icon_category', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ICON_CATEGORY_LABEL', + 'type' => 'media', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'icon_add' => [ + 'name' => 'icon_add', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ICON_ADD_LABEL', + 'type' => 'media', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'php_after_cancel' => [ + 'name' => 'php_after_cancel', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_AFTER_CANCEL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'mysql_table_charset' => [ + 'name' => 'mysql_table_charset', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_MYSQL_TABLE_CHARSET_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'MySQL', + ], + 'php_batchmove' => [ + 'name' => 'php_batchmove', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_BATCHMOVE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'type' => [ + 'name' => 'type', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_TYPE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'php_after_delete' => [ + 'name' => 'php_after_delete', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_AFTER_DELETE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'source' => [ + 'name' => 'source', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_SOURCE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'MySQL', + ], + 'php_import' => [ + 'name' => 'php_import', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Import', + ], + 'addpermissions' => [ + 'name' => 'addpermissions', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADDPERMISSIONS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'json', + 'tab_name' => 'Settings', + ], + 'php_getitems_after_all' => [ + 'name' => 'php_getitems_after_all', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETITEMS_AFTER_ALL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_getform' => [ + 'name' => 'php_getform', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETFORM_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'addtabs' => [ + 'name' => 'addtabs', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADDTABS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'json', + 'tab_name' => 'Settings', + ], + 'php_save' => [ + 'name' => 'php_save', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_SAVE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_allowadd' => [ + 'name' => 'php_allowadd', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_ALLOWADD_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_before_cancel' => [ + 'name' => 'php_before_cancel', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_BEFORE_CANCEL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'addlinked_views' => [ + 'name' => 'addlinked_views', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADDLINKED_VIEWS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'json', + 'tab_name' => 'Settings', + ], + 'php_batchcopy' => [ + 'name' => 'php_batchcopy', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_BATCHCOPY_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_before_publish' => [ + 'name' => 'php_before_publish', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_BEFORE_PUBLISH_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'alias_builder_type' => [ + 'name' => 'alias_builder_type', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ALIAS_BUILDER_TYPE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Fields', + ], + 'php_before_delete' => [ + 'name' => 'php_before_delete', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_BEFORE_DELETE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_document' => [ + 'name' => 'php_document', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_DOCUMENT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'mysql_table_row_format' => [ + 'name' => 'mysql_table_row_format', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_MYSQL_TABLE_ROW_FORMAT_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'MySQL', + ], + 'alias_builder' => [ + 'name' => 'alias_builder', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ALIAS_BUILDER_LABEL', + 'type' => 'aliasbuilder', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'json', + 'tab_name' => 'Fields', + ], + 'sql' => [ + 'name' => 'sql', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_SQL_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'MySQL', + ], + 'php_import_display' => [ + 'name' => 'php_import_display', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_DISPLAY_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Import', + ], + 'add_category_submenu' => [ + 'name' => 'add_category_submenu', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CATEGORY_SUBMENU_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Fields', + ], + 'php_import_setdata' => [ + 'name' => 'php_import_setdata', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_SETDATA_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Import', + ], + 'name_list' => [ + 'name' => 'name_list', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_LIST_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'add_php_getlistquery' => [ + 'name' => 'add_php_getlistquery', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_GETLISTQUERY_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'add_css_view' => [ + 'name' => 'add_css_view', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CSS_VIEW_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'CSS', + ], + 'add_php_getform' => [ + 'name' => 'add_php_getform', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_GETFORM_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'css_view' => [ + 'name' => 'css_view', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_CSS_VIEW_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'CSS', + ], + 'add_php_before_save' => [ + 'name' => 'add_php_before_save', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_BEFORE_SAVE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'add_css_views' => [ + 'name' => 'add_css_views', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CSS_VIEWS_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'CSS', + ], + 'add_php_save' => [ + 'name' => 'add_php_save', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_SAVE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'css_views' => [ + 'name' => 'css_views', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_CSS_VIEWS_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'CSS', + ], + 'add_php_postsavehook' => [ + 'name' => 'add_php_postsavehook', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_POSTSAVEHOOK_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'add_javascript_view_file' => [ + 'name' => 'add_javascript_view_file', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_JAVASCRIPT_VIEW_FILE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'JavaScript', + ], + 'add_php_allowadd' => [ + 'name' => 'add_php_allowadd', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_ALLOWADD_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'javascript_view_file' => [ + 'name' => 'javascript_view_file', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_JAVASCRIPT_VIEW_FILE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript', + ], + 'add_php_allowedit' => [ + 'name' => 'add_php_allowedit', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_ALLOWEDIT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'add_javascript_view_footer' => [ + 'name' => 'add_javascript_view_footer', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_JAVASCRIPT_VIEW_FOOTER_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'JavaScript', + ], + 'add_php_before_cancel' => [ + 'name' => 'add_php_before_cancel', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_BEFORE_CANCEL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'javascript_view_footer' => [ + 'name' => 'javascript_view_footer', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_JAVASCRIPT_VIEW_FOOTER_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript', + ], + 'add_php_after_cancel' => [ + 'name' => 'add_php_after_cancel', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AFTER_CANCEL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'add_javascript_views_file' => [ + 'name' => 'add_javascript_views_file', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_JAVASCRIPT_VIEWS_FILE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'JavaScript', + ], + 'add_php_batchcopy' => [ + 'name' => 'add_php_batchcopy', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_BATCHCOPY_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'javascript_views_file' => [ + 'name' => 'javascript_views_file', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_JAVASCRIPT_VIEWS_FILE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript', + ], + 'add_php_batchmove' => [ + 'name' => 'add_php_batchmove', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_BATCHMOVE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'add_javascript_views_footer' => [ + 'name' => 'add_javascript_views_footer', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_JAVASCRIPT_VIEWS_FOOTER_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'JavaScript', + ], + 'add_php_before_publish' => [ + 'name' => 'add_php_before_publish', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_BEFORE_PUBLISH_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'javascript_views_footer' => [ + 'name' => 'javascript_views_footer', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_JAVASCRIPT_VIEWS_FOOTER_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript', + ], + 'add_php_after_publish' => [ + 'name' => 'add_php_after_publish', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AFTER_PUBLISH_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'add_custom_button' => [ + 'name' => 'add_custom_button', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Custom Buttons', + ], + 'add_php_before_delete' => [ + 'name' => 'add_php_before_delete', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_BEFORE_DELETE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'custom_button' => [ + 'name' => 'custom_button', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_CUSTOM_BUTTON_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'json', + 'tab_name' => 'Custom Buttons', + ], + 'add_php_after_delete' => [ + 'name' => 'add_php_after_delete', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AFTER_DELETE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'php_controller' => [ + 'name' => 'php_controller', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_CONTROLLER_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Buttons', + ], + 'add_php_document' => [ + 'name' => 'add_php_document', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_DOCUMENT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'php_model' => [ + 'name' => 'php_model', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_MODEL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Buttons', + ], + 'mysql_table_engine' => [ + 'name' => 'mysql_table_engine', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_MYSQL_TABLE_ENGINE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'MySQL', + ], + 'php_controller_list' => [ + 'name' => 'php_controller_list', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_CONTROLLER_LIST_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Buttons', + ], + 'mysql_table_collate' => [ + 'name' => 'mysql_table_collate', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_MYSQL_TABLE_COLLATE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'MySQL', + ], + 'php_model_list' => [ + 'name' => 'php_model_list', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_MODEL_LIST_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Buttons', + ], + 'add_sql' => [ + 'name' => 'add_sql', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_SQL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'MySQL', + ], + 'add_php_ajax' => [ + 'name' => 'add_php_ajax', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AJAX_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'addtables' => [ + 'name' => 'addtables', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADDTABLES_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'json', + 'tab_name' => 'MySQL', + ], + 'php_ajaxmethod' => [ + 'name' => 'php_ajaxmethod', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_AJAXMETHOD_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'ajax_input' => [ + 'name' => 'ajax_input', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_AJAX_INPUT_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'json', + 'tab_name' => 'PHP', + ], + 'add_custom_import' => [ + 'name' => 'add_custom_import', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_IMPORT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'Custom Import', + ], + 'add_php_getitem' => [ + 'name' => 'add_php_getitem', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_GETITEM_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'html_import_view' => [ + 'name' => 'html_import_view', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_HTML_IMPORT_VIEW_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Import', + ], + 'php_getitem' => [ + 'name' => 'php_getitem', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETITEM_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_import_headers' => [ + 'name' => 'php_import_headers', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_HEADERS_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Import', + ], + 'add_php_getitems' => [ + 'name' => 'add_php_getitems', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_GETITEMS_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'php_import_save' => [ + 'name' => 'php_import_save', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_SAVE_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Import', + ], + 'php_getitems' => [ + 'name' => 'php_getitems', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETITEMS_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'add_php_getitems_after_all' => [ + 'name' => 'add_php_getitems_after_all', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_GETITEMS_AFTER_ALL_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + ], + 'custom_admin_view' => [ + 'system_name' => [ + 'name' => 'system_name', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_SYSTEM_NAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DESCRIPTION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'main_get' => [ + 'name' => 'main_get', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_MAIN_GET_LABEL', + 'type' => 'maingets', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'add_php_jview_display' => [ + 'name' => 'add_php_jview_display', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_JVIEW_DISPLAY_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'css_document' => [ + 'name' => 'css_document', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CSS_DOCUMENT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript & CSS', + ], + 'css' => [ + 'name' => 'css', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CSS_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript & CSS', + ], + 'js_document' => [ + 'name' => 'js_document', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_JS_DOCUMENT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript & CSS', + ], + 'javascript_file' => [ + 'name' => 'javascript_file', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_JAVASCRIPT_FILE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript & CSS', + ], + 'codename' => [ + 'name' => 'codename', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CODENAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'default' => [ + 'name' => 'default', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DEFAULT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + 'snippet' => [ + 'name' => 'snippet', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_SNIPPET_LABEL', + 'type' => 'snippets', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'icon' => [ + 'name' => 'icon', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ICON_LABEL', + 'type' => 'media', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'add_php_jview' => [ + 'name' => 'add_php_jview', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_JVIEW_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'context' => [ + 'name' => 'context', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CONTEXT_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'add_js_document' => [ + 'name' => 'add_js_document', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_JS_DOCUMENT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'JavaScript & CSS', + ], + 'custom_get' => [ + 'name' => 'custom_get', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CUSTOM_GET_LABEL', + 'type' => 'customgets', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'json', + 'tab_name' => 'Details', + ], + 'add_javascript_file' => [ + 'name' => 'add_javascript_file', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_JAVASCRIPT_FILE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'JavaScript & CSS', + ], + 'php_ajaxmethod' => [ + 'name' => 'php_ajaxmethod', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_AJAXMETHOD_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'add_css_document' => [ + 'name' => 'add_css_document', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CSS_DOCUMENT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'JavaScript & CSS', + ], + 'add_php_document' => [ + 'name' => 'add_php_document', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_DOCUMENT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'add_css' => [ + 'name' => 'add_css', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CSS_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'JavaScript & CSS', + ], + 'add_php_view' => [ + 'name' => 'add_php_view', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_VIEW_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'add_php_ajax' => [ + 'name' => 'add_php_ajax', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_AJAX_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'libraries' => [ + 'name' => 'libraries', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_LIBRARIES_LABEL', + 'type' => 'libraries', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'json', + 'tab_name' => 'Details', + ], + 'ajax_input' => [ + 'name' => 'ajax_input', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_AJAX_INPUT_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'json', + 'tab_name' => 'PHP', + ], + 'dynamic_get' => [ + 'name' => 'dynamic_get', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DYNAMIC_GET_LABEL', + 'type' => 'dynamicgets', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'php_document' => [ + 'name' => 'php_document', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_DOCUMENT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_view' => [ + 'name' => 'php_view', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_VIEW_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'add_custom_button' => [ + 'name' => 'add_custom_button', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'Custom Buttons', + ], + 'php_jview_display' => [ + 'name' => 'php_jview_display', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_DISPLAY_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'custom_button' => [ + 'name' => 'custom_button', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CUSTOM_BUTTON_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'json', + 'tab_name' => 'Custom Buttons', + ], + 'php_jview' => [ + 'name' => 'php_jview', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_controller' => [ + 'name' => 'php_controller', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_CONTROLLER_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Buttons', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'php_model' => [ + 'name' => 'php_model', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_MODEL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_admin_views', + 'store' => 'base64', + 'tab_name' => 'Custom Buttons', + ], + ], + 'site_view' => [ + 'system_name' => [ + 'name' => 'system_name', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_SYSTEM_NAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_DESCRIPTION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'main_get' => [ + 'name' => 'main_get', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_MAIN_GET_LABEL', + 'type' => 'maingets', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'add_php_jview_display' => [ + 'name' => 'add_php_jview_display', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_JVIEW_DISPLAY_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'add_php_document' => [ + 'name' => 'add_php_document', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_DOCUMENT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'add_php_view' => [ + 'name' => 'add_php_view', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_VIEW_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'js_document' => [ + 'name' => 'js_document', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_JS_DOCUMENT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript & CSS', + ], + 'codename' => [ + 'name' => 'codename', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_CODENAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'javascript_file' => [ + 'name' => 'javascript_file', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_JAVASCRIPT_FILE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript & CSS', + ], + 'context' => [ + 'name' => 'context', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_CONTEXT_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'default' => [ + 'name' => 'default', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_DEFAULT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + 'snippet' => [ + 'name' => 'snippet', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_SNIPPET_LABEL', + 'type' => 'snippets', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'add_php_jview' => [ + 'name' => 'add_php_jview', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_JVIEW_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'custom_get' => [ + 'name' => 'custom_get', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_CUSTOM_GET_LABEL', + 'type' => 'customgets', + 'title' => false, + 'list' => 'site_views', + 'store' => 'json', + 'tab_name' => 'Details', + ], + 'css_document' => [ + 'name' => 'css_document', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_CSS_DOCUMENT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript & CSS', + ], + 'add_javascript_file' => [ + 'name' => 'add_javascript_file', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_ADD_JAVASCRIPT_FILE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'JavaScript & CSS', + ], + 'css' => [ + 'name' => 'css', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_CSS_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'JavaScript & CSS', + ], + 'add_js_document' => [ + 'name' => 'add_js_document', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_ADD_JS_DOCUMENT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'JavaScript & CSS', + ], + 'php_ajaxmethod' => [ + 'name' => 'php_ajaxmethod', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_PHP_AJAXMETHOD_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'add_css_document' => [ + 'name' => 'add_css_document', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_ADD_CSS_DOCUMENT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'JavaScript & CSS', + ], + 'libraries' => [ + 'name' => 'libraries', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_LIBRARIES_LABEL', + 'type' => 'libraries', + 'title' => false, + 'list' => 'site_views', + 'store' => 'json', + 'tab_name' => 'Details', + ], + 'add_css' => [ + 'name' => 'add_css', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_ADD_CSS_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'JavaScript & CSS', + ], + 'dynamic_get' => [ + 'name' => 'dynamic_get', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_DYNAMIC_GET_LABEL', + 'type' => 'dynamicgets', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'add_php_ajax' => [ + 'name' => 'add_php_ajax', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_AJAX_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'PHP', + ], + 'ajax_input' => [ + 'name' => 'ajax_input', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_AJAX_INPUT_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'site_views', + 'store' => 'json', + 'tab_name' => 'PHP', + ], + 'add_custom_button' => [ + 'name' => 'add_custom_button', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_ADD_CUSTOM_BUTTON_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'Custom Buttons', + ], + 'php_document' => [ + 'name' => 'php_document', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_PHP_DOCUMENT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'button_position' => [ + 'name' => 'button_position', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_BUTTON_POSITION_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'Custom Buttons', + ], + 'php_view' => [ + 'name' => 'php_view', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_PHP_VIEW_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_jview_display' => [ + 'name' => 'php_jview_display', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_PHP_JVIEW_DISPLAY_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'custom_button' => [ + 'name' => 'custom_button', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_CUSTOM_BUTTON_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'site_views', + 'store' => 'json', + 'tab_name' => 'Custom Buttons', + ], + 'php_jview' => [ + 'name' => 'php_jview', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_PHP_JVIEW_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'PHP', + ], + 'php_controller' => [ + 'name' => 'php_controller', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_PHP_CONTROLLER_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'Custom Buttons', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'site_views', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'php_model' => [ + 'name' => 'php_model', + 'label' => 'COM_COMPONENTBUILDER_SITE_VIEW_PHP_MODEL_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'site_views', + 'store' => 'base64', + 'tab_name' => 'Custom Buttons', + ], + ], + 'template' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_TEMPLATE_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'templates', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_TEMPLATE_DESCRIPTION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'templates', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'dynamic_get' => [ + 'name' => 'dynamic_get', + 'label' => 'COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_GET_LABEL', + 'type' => 'dynamicget', + 'title' => false, + 'list' => 'templates', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'php_view' => [ + 'name' => 'php_view', + 'label' => 'COM_COMPONENTBUILDER_TEMPLATE_PHP_VIEW_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'templates', + 'store' => 'base64', + 'tab_name' => 'Custom Script', + ], + 'add_php_view' => [ + 'name' => 'add_php_view', + 'label' => 'COM_COMPONENTBUILDER_TEMPLATE_ADD_PHP_VIEW_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'templates', + 'store' => NULL, + 'tab_name' => 'Custom Script', + ], + 'template' => [ + 'name' => 'template', + 'label' => 'COM_COMPONENTBUILDER_TEMPLATE_TEMPLATE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'templates', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + 'snippet' => [ + 'name' => 'snippet', + 'label' => 'COM_COMPONENTBUILDER_TEMPLATE_SNIPPET_LABEL', + 'type' => 'snippets', + 'title' => false, + 'list' => 'templates', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'libraries' => [ + 'name' => 'libraries', + 'label' => 'COM_COMPONENTBUILDER_TEMPLATE_LIBRARIES_LABEL', + 'type' => 'libraries', + 'title' => false, + 'list' => 'templates', + 'store' => 'json', + 'tab_name' => 'Details', + ], + 'alias' => [ + 'name' => 'alias', + 'label' => 'COM_COMPONENTBUILDER_TEMPLATE_ALIAS_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'templates', + 'store' => NULL, + 'tab_name' => 'Details', + ], + ], + 'layout' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_LAYOUT_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'layouts', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_LAYOUT_DESCRIPTION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'layouts', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'dynamic_get' => [ + 'name' => 'dynamic_get', + 'label' => 'COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_GET_LABEL', + 'type' => 'dynamicget', + 'title' => false, + 'list' => 'layouts', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'snippet' => [ + 'name' => 'snippet', + 'label' => 'COM_COMPONENTBUILDER_LAYOUT_SNIPPET_LABEL', + 'type' => 'snippets', + 'title' => false, + 'list' => 'layouts', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'php_view' => [ + 'name' => 'php_view', + 'label' => 'COM_COMPONENTBUILDER_LAYOUT_PHP_VIEW_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'layouts', + 'store' => 'base64', + 'tab_name' => 'Custom Script', + ], + 'add_php_view' => [ + 'name' => 'add_php_view', + 'label' => 'COM_COMPONENTBUILDER_LAYOUT_ADD_PHP_VIEW_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'layouts', + 'store' => NULL, + 'tab_name' => 'Custom Script', + ], + 'layout' => [ + 'name' => 'layout', + 'label' => 'COM_COMPONENTBUILDER_LAYOUT_LAYOUT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'layouts', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + 'libraries' => [ + 'name' => 'libraries', + 'label' => 'COM_COMPONENTBUILDER_LAYOUT_LIBRARIES_LABEL', + 'type' => 'libraries', + 'title' => false, + 'list' => 'layouts', + 'store' => 'json', + 'tab_name' => 'Details', + ], + 'alias' => [ + 'name' => 'alias', + 'label' => 'COM_COMPONENTBUILDER_LAYOUT_ALIAS_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'layouts', + 'store' => NULL, + 'tab_name' => 'Details', + ], + ], + 'dynamic_get' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'dynamic_gets', + 'store' => NULL, + 'tab_name' => 'Main', + ], + 'main_source' => [ + 'name' => 'main_source', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_MAIN_SOURCE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => NULL, + 'tab_name' => 'Main', + ], + 'gettype' => [ + 'name' => 'gettype', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_GETTYPE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'dynamic_gets', + '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', + 'type' => 'textarea', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => 'base64', + 'tab_name' => 'Custom Script', + ], + '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' => NULL, + 'tab_name' => 'Custom Script', + ], + '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', + ], + 'view_selection' => [ + 'name' => 'view_selection', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_SELECTION_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'dynamic_gets', + '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', + 'type' => 'dbtables', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => NULL, + 'tab_name' => 'Main', + ], + 'php_custom_get' => [ + 'name' => 'php_custom_get', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_CUSTOM_GET_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => 'base64', + 'tab_name' => 'Main', + ], + 'plugin_events' => [ + 'name' => 'plugin_events', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PLUGIN_EVENTS_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => 'json', + 'tab_name' => 'Main', + ], + 'db_selection' => [ + 'name' => 'db_selection', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_DB_SELECTION_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => NULL, + 'tab_name' => 'Main', + ], + 'view_table_main' => [ + 'name' => 'view_table_main', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_MAIN_LABEL', + 'type' => 'adminviews', + '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', + 'type' => 'radio', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => NULL, + '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', + ], + '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' => [ + 'name' => 'filter', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_FILTER_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => 'json', + 'tab_name' => 'Tweak', + ], + 'php_after_getitems' => [ + 'name' => 'php_after_getitems', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_AFTER_GETITEMS_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => 'base64', + 'tab_name' => 'Custom Script', + ], + 'where' => [ + 'name' => 'where', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_WHERE_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => 'json', + 'tab_name' => 'Tweak', + ], + 'order' => [ + 'name' => 'order', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ORDER_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => 'json', + 'tab_name' => 'Tweak', + ], + 'addcalculation' => [ + 'name' => 'addcalculation', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADDCALCULATION_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => NULL, + 'tab_name' => 'Abacus', + ], + 'group' => [ + 'name' => 'group', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_GROUP_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => 'json', + 'tab_name' => 'Tweak', + ], + 'global' => [ + 'name' => 'global', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_GLOBAL_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => 'json', + 'tab_name' => 'Tweak', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'join_view_table' => [ + 'name' => 'join_view_table', + 'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_JOIN_VIEW_TABLE_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'dynamic_gets', + 'store' => 'json', + 'tab_name' => 'Joint', + ], + ], + 'custom_code' => [ + 'component' => [ + 'name' => 'component', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL', + 'type' => 'joomlacomponent', + 'title' => true, + 'list' => 'custom_codes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'path' => [ + 'name' => 'path', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_PATH_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_codes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'target' => [ + 'name' => 'target', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_TARGET_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_codes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'type' => [ + 'name' => 'type', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_codes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'comment_type' => [ + 'name' => 'comment_type', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_COMMENT_TYPE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'custom_codes', + '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', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_codes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'system_name' => [ + 'name' => 'system_name', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_SYSTEM_NAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_codes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'code' => [ + 'name' => 'code', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_CODE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'custom_codes', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + 'hashendtarget' => [ + 'name' => 'hashendtarget', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_HASHENDTARGET_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_codes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'to_line' => [ + 'name' => 'to_line', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_TO_LINE_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_codes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'from_line' => [ + 'name' => 'from_line', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_codes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'hashtarget' => [ + 'name' => 'hashtarget', + 'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'custom_codes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + ], + 'class_property' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'class_properties', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'visibility' => [ + 'name' => 'visibility', + 'label' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'class_properties', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'extension_type' => [ + 'name' => 'extension_type', + 'label' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'class_properties', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'class_properties', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'comment' => [ + 'name' => 'comment', + 'label' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_COMMENT_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'class_properties', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + 'joomla_plugin_group' => [ + 'name' => 'joomla_plugin_group', + 'label' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_JOOMLA_PLUGIN_GROUP_LABEL', + 'type' => 'joomlaplugingroups', + 'title' => false, + 'list' => 'class_properties', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'default' => [ + 'name' => 'default', + 'label' => 'COM_COMPONENTBUILDER_CLASS_PROPERTY_DEFAULT_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'class_properties', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + ], + 'class_method' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_CLASS_METHOD_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'class_methods', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'visibility' => [ + 'name' => 'visibility', + 'label' => 'COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'class_methods', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'extension_type' => [ + 'name' => 'extension_type', + 'label' => 'COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'class_methods', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_CLASS_METHOD_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'class_methods', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'code' => [ + 'name' => 'code', + 'label' => 'COM_COMPONENTBUILDER_CLASS_METHOD_CODE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'class_methods', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + 'comment' => [ + 'name' => 'comment', + 'label' => 'COM_COMPONENTBUILDER_CLASS_METHOD_COMMENT_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'class_methods', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + 'joomla_plugin_group' => [ + 'name' => 'joomla_plugin_group', + 'label' => 'COM_COMPONENTBUILDER_CLASS_METHOD_JOOMLA_PLUGIN_GROUP_LABEL', + 'type' => 'joomlaplugingroups', + 'title' => false, + 'list' => 'class_methods', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'arguments' => [ + 'name' => 'arguments', + 'label' => 'COM_COMPONENTBUILDER_CLASS_METHOD_ARGUMENTS_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'class_methods', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + ], + 'placeholder' => [ + 'target' => [ + 'name' => 'target', + 'label' => 'COM_COMPONENTBUILDER_PLACEHOLDER_TARGET_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'placeholders', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'value' => [ + 'name' => 'value', + 'label' => 'COM_COMPONENTBUILDER_PLACEHOLDER_VALUE_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'placeholders', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + ], + 'library' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'libraries', + 'store' => NULL, + 'tab_name' => 'Behaviour', + ], + 'target' => [ + 'name' => 'target', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_TARGET_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'libraries', + 'store' => NULL, + 'tab_name' => 'Behaviour', + ], + 'how' => [ + 'name' => 'how', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_HOW_LABEL', + 'type' => 'filebehaviour', + 'title' => false, + 'list' => 'libraries', + 'store' => NULL, + 'tab_name' => 'Behaviour', + ], + 'type' => [ + 'name' => 'type', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_TYPE_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'libraries', + 'store' => NULL, + 'tab_name' => 'Behaviour', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'libraries', + 'store' => NULL, + 'tab_name' => 'Behaviour', + ], + 'libraries' => [ + 'name' => 'libraries', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_LIBRARIES_LABEL', + 'type' => 'librariesx', + 'title' => false, + 'list' => 'libraries', + 'store' => 'json', + 'tab_name' => 'Behaviour', + ], + 'php_setdocument' => [ + 'name' => 'php_setdocument', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_PHP_SETDOCUMENT_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'libraries', + 'store' => 'base64', + 'tab_name' => 'Behaviour', + ], + 'addconditions' => [ + 'name' => 'addconditions', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_ADDCONDITIONS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'libraries', + 'store' => 'json', + 'tab_name' => 'Behaviour', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'libraries', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + ], + 'snippet' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'url' => [ + 'name' => 'url', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_URL_LABEL', + 'type' => 'url', + 'title' => false, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'type' => [ + 'name' => 'type', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_TYPE_LABEL', + 'type' => 'snippettype', + 'title' => false, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'heading' => [ + 'name' => 'heading', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_HEADING_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'library' => [ + 'name' => 'library', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_LIBRARY_LABEL', + 'type' => 'library', + 'title' => false, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'contributor_email' => [ + 'name' => 'contributor_email', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_CONTRIBUTOR_EMAIL_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'Contributor', + ], + 'contributor_name' => [ + 'name' => 'contributor_name', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_CONTRIBUTOR_NAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'Contributor', + ], + 'contributor_website' => [ + 'name' => 'contributor_website', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_CONTRIBUTOR_WEBSITE_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'Contributor', + ], + 'contributor_company' => [ + 'name' => 'contributor_company', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_CONTRIBUTOR_COMPANY_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'Contributor', + ], + 'snippet' => [ + 'name' => 'snippet', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_SNIPPET_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'snippets', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + 'usage' => [ + 'name' => 'usage', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_USAGE_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_DESCRIPTION_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'snippets', + 'store' => NULL, + 'tab_name' => 'Details', + ], + ], + 'validation_rule' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_VALIDATION_RULE_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'validation_rules', + 'store' => NULL, + 'tab_name' => 'Extends FormRule', + ], + 'short_description' => [ + 'name' => 'short_description', + 'label' => 'COM_COMPONENTBUILDER_VALIDATION_RULE_SHORT_DESCRIPTION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'validation_rules', + 'store' => NULL, + 'tab_name' => 'Extends FormRule', + ], + 'inherit' => [ + 'name' => 'inherit', + 'label' => 'COM_COMPONENTBUILDER_VALIDATION_RULE_INHERIT_LABEL', + 'type' => 'existingvalidationrules', + 'title' => false, + 'list' => 'validation_rules', + 'store' => NULL, + 'tab_name' => 'Extends FormRule', + ], + 'php' => [ + 'name' => 'php', + 'label' => 'COM_COMPONENTBUILDER_VALIDATION_RULE_PHP_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'validation_rules', + 'store' => 'base64', + 'tab_name' => 'Extends FormRule', + ], + ], + 'field' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_FIELD_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Set Properties', + ], + 'fieldtype' => [ + 'name' => 'fieldtype', + 'label' => 'COM_COMPONENTBUILDER_FIELD_FIELDTYPE_LABEL', + 'type' => 'fieldtypes', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Set Properties', + ], + 'datatype' => [ + 'name' => 'datatype', + 'label' => 'COM_COMPONENTBUILDER_FIELD_DATATYPE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Database', + ], + 'indexes' => [ + 'name' => 'indexes', + 'label' => 'COM_COMPONENTBUILDER_FIELD_INDEXES_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Database', + ], + 'null_switch' => [ + 'name' => 'null_switch', + 'label' => 'COM_COMPONENTBUILDER_FIELD_NULL_SWITCH_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Database', + ], + 'store' => [ + 'name' => 'store', + 'label' => 'COM_COMPONENTBUILDER_FIELD_STORE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Database', + ], + 'catid' => [ + 'name' => 'catid', + 'label' => 'COM_COMPONENTBUILDER_FIELD_CATID_LABEL', + 'type' => 'category', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Set Properties', + ], + 'on_save_model_field' => [ + 'name' => 'on_save_model_field', + 'label' => 'COM_COMPONENTBUILDER_FIELD_ON_SAVE_MODEL_FIELD_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'fields', + 'store' => 'base64', + 'tab_name' => 'Database', + ], + 'initiator_on_get_model' => [ + 'name' => 'initiator_on_get_model', + 'label' => 'COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_GET_MODEL_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'fields', + 'store' => 'base64', + 'tab_name' => 'Database', + ], + 'initiator_on_save_model' => [ + 'name' => 'initiator_on_save_model', + 'label' => 'COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'fields', + 'store' => 'base64', + 'tab_name' => 'Database', + ], + 'xml' => [ + 'name' => 'xml', + 'label' => '', + 'type' => 'hidden', + 'title' => false, + 'list' => 'fields', + 'store' => 'json', + 'tab_name' => 'Type Info', + ], + 'datalenght' => [ + 'name' => 'datalenght', + 'label' => 'COM_COMPONENTBUILDER_FIELD_DATALENGHT_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Database', + ], + 'css_views' => [ + 'name' => 'css_views', + 'label' => 'COM_COMPONENTBUILDER_FIELD_CSS_VIEWS_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'fields', + 'store' => 'base64', + 'tab_name' => 'Scripts', + ], + 'css_view' => [ + 'name' => 'css_view', + 'label' => 'COM_COMPONENTBUILDER_FIELD_CSS_VIEW_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'fields', + 'store' => 'base64', + 'tab_name' => 'Scripts', + ], + 'datadefault_other' => [ + 'name' => 'datadefault_other', + 'label' => 'COM_COMPONENTBUILDER_FIELD_DATADEFAULT_OTHER_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Database', + ], + 'datadefault' => [ + 'name' => 'datadefault', + 'label' => 'COM_COMPONENTBUILDER_FIELD_DATADEFAULT_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Database', + ], + 'datalenght_other' => [ + 'name' => 'datalenght_other', + 'label' => 'COM_COMPONENTBUILDER_FIELD_DATALENGHT_OTHER_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Database', + ], + 'on_get_model_field' => [ + 'name' => 'on_get_model_field', + 'label' => 'COM_COMPONENTBUILDER_FIELD_ON_GET_MODEL_FIELD_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'fields', + 'store' => 'base64', + 'tab_name' => 'Database', + ], + 'javascript_view_footer' => [ + 'name' => 'javascript_view_footer', + 'label' => 'COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'fields', + 'store' => 'base64', + 'tab_name' => 'Scripts', + ], + 'javascript_views_footer' => [ + 'name' => 'javascript_views_footer', + 'label' => 'COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEWS_FOOTER_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'fields', + 'store' => 'base64', + 'tab_name' => 'Scripts', + ], + 'add_css_view' => [ + 'name' => 'add_css_view', + 'label' => 'COM_COMPONENTBUILDER_FIELD_ADD_CSS_VIEW_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Scripts', + ], + 'add_css_views' => [ + 'name' => 'add_css_views', + 'label' => 'COM_COMPONENTBUILDER_FIELD_ADD_CSS_VIEWS_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Scripts', + ], + 'add_javascript_view_footer' => [ + 'name' => 'add_javascript_view_footer', + 'label' => 'COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEW_FOOTER_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Scripts', + ], + 'add_javascript_views_footer' => [ + 'name' => 'add_javascript_views_footer', + 'label' => 'COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEWS_FOOTER_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'Scripts', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_FIELD_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'fields', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + ], + 'fieldtype' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'store' => [ + 'name' => 'store', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_STORE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Database (defaults)', + ], + 'null_switch' => [ + 'name' => 'null_switch', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_NULL_SWITCH_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Database (defaults)', + ], + 'indexes' => [ + 'name' => 'indexes', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_INDEXES_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Database (defaults)', + ], + 'datadefault_other' => [ + 'name' => 'datadefault_other', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_DATADEFAULT_OTHER_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Database (defaults)', + ], + 'datadefault' => [ + 'name' => 'datadefault', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_DATADEFAULT_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Database (defaults)', + ], + 'short_description' => [ + 'name' => 'short_description', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_SHORT_DESCRIPTION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'datatype' => [ + 'name' => 'datatype', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_DATATYPE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Database (defaults)', + ], + 'has_defaults' => [ + 'name' => 'has_defaults', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_HAS_DEFAULTS_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Database (defaults)', + ], + 'properties' => [ + 'name' => 'properties', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_PROPERTIES_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => 'json', + 'tab_name' => 'Details', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_DESCRIPTION_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'datalenght' => [ + 'name' => 'datalenght', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_DATALENGHT_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Database (defaults)', + ], + 'datalenght_other' => [ + 'name' => 'datalenght_other', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_DATALENGHT_OTHER_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Database (defaults)', + ], + 'guid' => [ + 'name' => 'guid', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_GUID_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'publishing', + ], + 'catid' => [ + 'name' => 'catid', + 'label' => 'COM_COMPONENTBUILDER_FIELDTYPE_CATID_LABEL', + 'type' => 'category', + 'title' => false, + 'list' => 'fieldtypes', + 'store' => NULL, + 'tab_name' => 'Details', + ], + ], + 'language_translation' => [ + 'source' => [ + 'name' => 'source', + 'label' => 'COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_SOURCE_LABEL', + 'type' => 'textarea', + 'title' => true, + 'list' => 'language_translations', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'plugins' => [ + 'name' => 'plugins', + 'label' => 'COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_PLUGINS_LABEL', + 'type' => 'joomlaplugins', + 'title' => false, + 'list' => 'language_translations', + 'store' => 'json', + 'tab_name' => 'Details', + ], + 'modules' => [ + 'name' => 'modules', + 'label' => 'COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_MODULES_LABEL', + 'type' => 'joomlamodules', + 'title' => false, + 'list' => 'language_translations', + 'store' => 'json', + 'tab_name' => 'Details', + ], + 'components' => [ + 'name' => 'components', + 'label' => 'COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_COMPONENTS_LABEL', + 'type' => 'joomlacomponents', + 'title' => false, + 'list' => 'language_translations', + 'store' => 'json', + 'tab_name' => 'Details', + ], + 'translation' => [ + 'name' => 'translation', + 'label' => 'COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_TRANSLATION_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'language_translations', + 'store' => 'json', + 'tab_name' => 'Details', + ], + ], + 'language' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_LANGUAGE_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'languages', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'langtag' => [ + 'name' => 'langtag', + 'label' => 'COM_COMPONENTBUILDER_LANGUAGE_LANGTAG_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'languages', + 'store' => NULL, + 'tab_name' => 'Details', + ], + ], + 'server' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_SERVER_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'servers', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'protocol' => [ + 'name' => 'protocol', + 'label' => 'COM_COMPONENTBUILDER_SERVER_PROTOCOL_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'servers', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'signature' => [ + 'name' => 'signature', + 'label' => 'COM_COMPONENTBUILDER_SERVER_SIGNATURE_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'servers', + 'store' => 'basic_encryption', + 'tab_name' => 'Details', + ], + 'private_key' => [ + 'name' => 'private_key', + 'label' => 'COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'servers', + 'store' => 'basic_encryption', + 'tab_name' => 'Details', + ], + 'secret' => [ + 'name' => 'secret', + 'label' => 'COM_COMPONENTBUILDER_SERVER_SECRET_LABEL', + 'type' => 'password', + 'title' => false, + 'list' => 'servers', + 'store' => 'basic_encryption', + 'tab_name' => 'Details', + ], + 'password' => [ + 'name' => 'password', + 'label' => 'COM_COMPONENTBUILDER_SERVER_PASSWORD_LABEL', + 'type' => 'password', + 'title' => false, + 'list' => 'servers', + 'store' => 'basic_encryption', + 'tab_name' => 'Details', + ], + 'private' => [ + 'name' => 'private', + 'label' => 'COM_COMPONENTBUILDER_SERVER_PRIVATE_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'servers', + 'store' => 'basic_encryption', + 'tab_name' => 'Details', + ], + 'authentication' => [ + 'name' => 'authentication', + 'label' => 'COM_COMPONENTBUILDER_SERVER_AUTHENTICATION_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'servers', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'path' => [ + 'name' => 'path', + 'label' => 'COM_COMPONENTBUILDER_SERVER_PATH_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'servers', + 'store' => 'basic_encryption', + 'tab_name' => 'Details', + ], + 'port' => [ + 'name' => 'port', + 'label' => 'COM_COMPONENTBUILDER_SERVER_PORT_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'servers', + 'store' => 'basic_encryption', + 'tab_name' => 'Details', + ], + 'host' => [ + 'name' => 'host', + 'label' => 'COM_COMPONENTBUILDER_SERVER_HOST_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'servers', + 'store' => 'basic_encryption', + 'tab_name' => 'Details', + ], + 'username' => [ + 'name' => 'username', + 'label' => 'COM_COMPONENTBUILDER_SERVER_USERNAME_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'servers', + 'store' => 'basic_encryption', + 'tab_name' => 'Details', + ], + ], + 'help_document' => [ + 'title' => [ + 'name' => 'title', + 'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_TITLE_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'help_documents', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'type' => [ + 'name' => 'type', + 'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_TYPE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'help_documents', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'groups' => [ + 'name' => 'groups', + 'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_GROUPS_LABEL', + 'type' => 'usergrouplist', + 'title' => false, + 'list' => 'help_documents', + 'store' => 'json', + 'tab_name' => 'Details', + ], + 'location' => [ + 'name' => 'location', + 'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_LOCATION_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'help_documents', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'admin_view' => [ + 'name' => 'admin_view', + 'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_ADMIN_VIEW_LABEL', + 'type' => 'adminviewfolderlist', + 'title' => false, + 'list' => 'help_documents', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'site_view' => [ + 'name' => 'site_view', + 'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_SITE_VIEW_LABEL', + 'type' => 'siteviewfolderlist', + 'title' => false, + 'list' => 'help_documents', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'not_required' => [ + 'name' => 'not_required', + 'label' => '', + 'type' => 'hidden', + 'title' => false, + 'list' => 'help_documents', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'content' => [ + 'name' => 'content', + 'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_CONTENT_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'help_documents', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'article' => [ + 'name' => 'article', + 'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_ARTICLE_LABEL', + 'type' => 'articles', + 'title' => false, + 'list' => 'help_documents', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'url' => [ + 'name' => 'url', + 'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_URL_LABEL', + 'type' => 'url', + 'title' => false, + 'list' => 'help_documents', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'target' => [ + 'name' => 'target', + 'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_TARGET_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'help_documents', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'alias' => [ + 'name' => 'alias', + 'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_ALIAS_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'help_documents', + 'store' => NULL, + 'tab_name' => 'Details', + ], + ], + 'admin_fields' => [ + 'admin_view' => [ + 'name' => 'admin_view', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_FIELDS_ADMIN_VIEW_LABEL', + 'type' => 'adminviewsreadonly', + 'title' => true, + 'list' => 'admins_fields', + 'store' => NULL, + 'tab_name' => 'Fields', + ], + 'addfields' => [ + 'name' => 'addfields', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_FIELDS_ADDFIELDS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'admins_fields', + 'store' => 'json', + 'tab_name' => 'Fields', + ], + ], + 'admin_fields_conditions' => [ + 'admin_view' => [ + 'name' => 'admin_view', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ADMIN_VIEW_LABEL', + 'type' => 'adminviewsreadonly', + 'title' => true, + 'list' => 'admins_fields_conditions', + 'store' => NULL, + 'tab_name' => 'Conditions', + ], + 'addconditions' => [ + 'name' => 'addconditions', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ADDCONDITIONS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'admins_fields_conditions', + 'store' => 'json', + 'tab_name' => 'Conditions', + ], + ], + 'admin_fields_relations' => [ + 'admin_view' => [ + 'name' => 'admin_view', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ADMIN_VIEW_LABEL', + 'type' => 'adminviewsreadonly', + 'title' => true, + 'list' => 'admins_fields_relations', + 'store' => NULL, + 'tab_name' => 'Relations', + ], + 'addrelations' => [ + 'name' => 'addrelations', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_ADDRELATIONS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'admins_fields_relations', + 'store' => 'json', + 'tab_name' => 'Relations', + ], + ], + 'admin_custom_tabs' => [ + 'admin_view' => [ + 'name' => 'admin_view', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_ADMIN_VIEW_LABEL', + 'type' => 'adminviewsreadonly', + 'title' => true, + 'list' => 'admins_custom_tabs', + 'store' => NULL, + 'tab_name' => 'Tabs', + ], + 'tabs' => [ + 'name' => 'tabs', + 'label' => 'COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_TABS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'admins_custom_tabs', + 'store' => 'json', + 'tab_name' => 'Tabs', + ], + ], + 'component_admin_views' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_admin_views', + 'store' => NULL, + 'tab_name' => 'Views', + ], + 'addadmin_views' => [ + 'name' => 'addadmin_views', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDADMIN_VIEWS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_admin_views', + 'store' => 'json', + 'tab_name' => 'Views', + ], + ], + 'component_site_views' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_site_views', + 'store' => NULL, + 'tab_name' => 'Views', + ], + 'addsite_views' => [ + 'name' => 'addsite_views', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ADDSITE_VIEWS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_site_views', + 'store' => 'json', + 'tab_name' => 'Views', + ], + ], + 'component_custom_admin_views' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_custom_admin_views', + 'store' => NULL, + 'tab_name' => 'Views', + ], + 'addcustom_admin_views' => [ + 'name' => 'addcustom_admin_views', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_ADDCUSTOM_ADMIN_VIEWS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_custom_admin_views', + 'store' => 'json', + 'tab_name' => 'Views', + ], + ], + 'component_updates' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_UPDATES_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_updates', + 'store' => NULL, + 'tab_name' => 'Updates', + ], + 'version_update' => [ + 'name' => 'version_update', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_UPDATES_VERSION_UPDATE_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_updates', + 'store' => 'json', + 'tab_name' => 'Updates', + ], + ], + 'component_mysql_tweaks' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_mysql_tweaks', + 'store' => NULL, + 'tab_name' => 'Mysql Tweaks', + ], + 'sql_tweak' => [ + 'name' => 'sql_tweak', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_SQL_TWEAK_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_mysql_tweaks', + 'store' => 'json', + 'tab_name' => 'Mysql Tweaks', + ], + ], + 'component_custom_admin_menus' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_custom_admin_menus', + 'store' => NULL, + 'tab_name' => 'Menus', + ], + 'addcustommenus' => [ + 'name' => 'addcustommenus', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_ADDCUSTOMMENUS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_custom_admin_menus', + 'store' => 'json', + 'tab_name' => 'Menus', + ], + ], + 'component_router' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_routers', + 'store' => NULL, + 'tab_name' => 'Settings', + ], + 'mode_constructor_before_parent' => [ + 'name' => 'mode_constructor_before_parent', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODE_CONSTRUCTOR_BEFORE_PARENT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'components_routers', + 'store' => NULL, + 'tab_name' => 'Settings', + ], + 'mode_constructor_after_parent' => [ + 'name' => 'mode_constructor_after_parent', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODE_CONSTRUCTOR_AFTER_PARENT_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'components_routers', + 'store' => NULL, + 'tab_name' => 'Settings', + ], + 'mode_methods' => [ + 'name' => 'mode_methods', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_MODE_METHODS_LABEL', + 'type' => 'radio', + 'title' => false, + 'list' => 'components_routers', + 'store' => NULL, + 'tab_name' => 'Settings', + ], + 'methods_code' => [ + 'name' => 'methods_code', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_METHODS_CODE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'components_routers', + 'store' => 'base64', + 'tab_name' => 'Settings', + ], + 'constructor_after_parent_code' => [ + 'name' => 'constructor_after_parent_code', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_CONSTRUCTOR_AFTER_PARENT_CODE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'components_routers', + 'store' => 'base64', + 'tab_name' => 'Settings', + ], + 'constructor_before_parent_manual' => [ + 'name' => 'constructor_before_parent_manual', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_CONSTRUCTOR_BEFORE_PARENT_MANUAL_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_routers', + 'store' => 'json', + 'tab_name' => 'Settings', + ], + 'constructor_before_parent_code' => [ + 'name' => 'constructor_before_parent_code', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_CONSTRUCTOR_BEFORE_PARENT_CODE_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'components_routers', + 'store' => 'base64', + 'tab_name' => 'Settings', + ], + ], + 'component_config' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_CONFIG_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_config', + 'store' => NULL, + 'tab_name' => 'Options', + ], + 'addconfig' => [ + 'name' => 'addconfig', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_CONFIG_ADDCONFIG_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_config', + 'store' => 'json', + 'tab_name' => 'Options', + ], + ], + 'component_dashboard' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_dashboard', + 'store' => NULL, + 'tab_name' => 'Dashboard', + ], + 'dashboard_tab' => [ + 'name' => 'dashboard_tab', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_DASHBOARD_TAB_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_dashboard', + 'store' => 'json', + 'tab_name' => 'Dashboard', + ], + 'php_dashboard_methods' => [ + 'name' => 'php_dashboard_methods', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_PHP_DASHBOARD_METHODS_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'components_dashboard', + 'store' => 'base64', + 'tab_name' => 'Dashboard', + ], + ], + 'component_files_folders' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_files_folders', + 'store' => NULL, + 'tab_name' => 'Basic', + ], + 'addfoldersfullpath' => [ + 'name' => 'addfoldersfullpath', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_ADDFOLDERSFULLPATH_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_files_folders', + 'store' => 'json', + 'tab_name' => 'Advance', + ], + 'addfilesfullpath' => [ + 'name' => 'addfilesfullpath', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_ADDFILESFULLPATH_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_files_folders', + 'store' => 'json', + 'tab_name' => 'Advance', + ], + 'addfolders' => [ + 'name' => 'addfolders', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_ADDFOLDERS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_files_folders', + 'store' => 'json', + 'tab_name' => 'Basic', + ], + 'addfiles' => [ + 'name' => 'addfiles', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_ADDFILES_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_files_folders', + 'store' => 'json', + 'tab_name' => 'Basic', + ], + ], + 'component_placeholders' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_placeholders', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'addplaceholders' => [ + 'name' => 'addplaceholders', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_ADDPLACEHOLDERS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_placeholders', + 'store' => 'json', + 'tab_name' => 'Details', + ], + ], + 'component_plugins' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_plugins', + 'store' => NULL, + 'tab_name' => 'Plugins', + ], + 'addjoomla_plugins' => [ + 'name' => 'addjoomla_plugins', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_ADDJOOMLA_PLUGINS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_plugins', + 'store' => 'json', + 'tab_name' => 'Plugins', + ], + ], + 'component_modules' => [ + 'joomla_component' => [ + 'name' => 'joomla_component', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_MODULES_JOOMLA_COMPONENT_LABEL', + 'type' => 'joomlacomponents', + 'title' => true, + 'list' => 'components_modules', + 'store' => NULL, + 'tab_name' => 'Modules', + ], + 'addjoomla_modules' => [ + 'name' => 'addjoomla_modules', + 'label' => 'COM_COMPONENTBUILDER_COMPONENT_MODULES_ADDJOOMLA_MODULES_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'components_modules', + 'store' => 'json', + 'tab_name' => 'Modules', + ], + ], + 'snippet_type' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_TYPE_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'snippet_types', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'description' => [ + 'name' => 'description', + 'label' => 'COM_COMPONENTBUILDER_SNIPPET_TYPE_DESCRIPTION_LABEL', + 'type' => 'text', + 'title' => false, + 'list' => 'snippet_types', + 'store' => NULL, + 'tab_name' => 'Details', + ], + ], + 'library_config' => [ + 'library' => [ + 'name' => 'library', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_CONFIG_LIBRARY_LABEL', + 'type' => 'libraryreadonly', + 'title' => true, + 'list' => 'libraries_config', + 'store' => NULL, + 'tab_name' => 'Tweaks', + ], + 'addconfig' => [ + 'name' => 'addconfig', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_CONFIG_ADDCONFIG_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'libraries_config', + 'store' => 'json', + 'tab_name' => 'Tweaks', + ], + ], + 'library_files_folders_urls' => [ + 'library' => [ + 'name' => 'library', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_LIBRARY_LABEL', + 'type' => 'libraryreadonly', + 'title' => true, + 'list' => 'libraries_files_folders_urls', + 'store' => NULL, + 'tab_name' => 'Basic', + ], + 'addfoldersfullpath' => [ + 'name' => 'addfoldersfullpath', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ADDFOLDERSFULLPATH_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'libraries_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Advance', + ], + 'addfilesfullpath' => [ + 'name' => 'addfilesfullpath', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ADDFILESFULLPATH_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'libraries_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Advance', + ], + 'addfolders' => [ + 'name' => 'addfolders', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ADDFOLDERS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'libraries_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Basic', + ], + 'addfiles' => [ + 'name' => 'addfiles', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ADDFILES_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'libraries_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Basic', + ], + 'addurls' => [ + 'name' => 'addurls', + 'label' => 'COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ADDURLS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'libraries_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Basic', + ], + ], + 'class_extends' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'class_extendings', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'extension_type' => [ + 'name' => 'extension_type', + 'label' => 'COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL', + 'type' => 'list', + 'title' => false, + 'list' => 'class_extendings', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'head' => [ + 'name' => 'head', + 'label' => 'COM_COMPONENTBUILDER_CLASS_EXTENDS_HEAD_LABEL', + 'type' => 'editor', + 'title' => false, + 'list' => 'class_extendings', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + 'comment' => [ + 'name' => 'comment', + 'label' => 'COM_COMPONENTBUILDER_CLASS_EXTENDS_COMMENT_LABEL', + 'type' => 'textarea', + 'title' => false, + 'list' => 'class_extendings', + 'store' => 'base64', + 'tab_name' => 'Details', + ], + ], + 'joomla_module_updates' => [ + 'joomla_module' => [ + 'name' => 'joomla_module', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_JOOMLA_MODULE_LABEL', + 'type' => 'joomlamodules', + 'title' => true, + 'list' => 'joomla_modules_updates', + 'store' => NULL, + 'tab_name' => 'Updates', + ], + 'version_update' => [ + 'name' => 'version_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_VERSION_UPDATE_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_modules_updates', + 'store' => 'json', + 'tab_name' => 'Updates', + ], + ], + 'joomla_module_files_folders_urls' => [ + 'joomla_module' => [ + 'name' => 'joomla_module', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_JOOMLA_MODULE_LABEL', + 'type' => 'joomlamodules', + 'title' => true, + 'list' => 'joomla_modules_files_folders_urls', + 'store' => NULL, + 'tab_name' => 'Basic', + ], + 'addfoldersfullpath' => [ + 'name' => 'addfoldersfullpath', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_ADDFOLDERSFULLPATH_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_modules_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Advance', + ], + 'addfilesfullpath' => [ + 'name' => 'addfilesfullpath', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_ADDFILESFULLPATH_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_modules_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Advance', + ], + 'addfolders' => [ + 'name' => 'addfolders', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_ADDFOLDERS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_modules_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Basic', + ], + 'addfiles' => [ + 'name' => 'addfiles', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_ADDFILES_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_modules_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Basic', + ], + 'addurls' => [ + 'name' => 'addurls', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE_FILES_FOLDERS_URLS_ADDURLS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_modules_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Basic', + ], + ], + 'joomla_plugin_group' => [ + 'name' => [ + 'name' => 'name', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_LABEL', + 'type' => 'text', + 'title' => true, + 'list' => 'joomla_plugin_groups', + 'store' => NULL, + 'tab_name' => 'Details', + ], + 'class_extends' => [ + 'name' => 'class_extends', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_LABEL', + 'type' => 'classextends', + 'title' => false, + 'list' => 'joomla_plugin_groups', + 'store' => NULL, + 'tab_name' => 'Details', + ], + ], + 'joomla_plugin_updates' => [ + 'joomla_plugin' => [ + 'name' => 'joomla_plugin', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_JOOMLA_PLUGIN_LABEL', + 'type' => 'joomlaplugins', + 'title' => true, + 'list' => 'joomla_plugins_updates', + 'store' => NULL, + 'tab_name' => 'Updates', + ], + 'version_update' => [ + 'name' => 'version_update', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_VERSION_UPDATE_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_plugins_updates', + 'store' => 'json', + 'tab_name' => 'Updates', + ], + ], + 'joomla_plugin_files_folders_urls' => [ + 'joomla_plugin' => [ + 'name' => 'joomla_plugin', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_JOOMLA_PLUGIN_LABEL', + 'type' => 'joomlaplugins', + 'title' => true, + 'list' => 'joomla_plugins_files_folders_urls', + 'store' => NULL, + 'tab_name' => 'Basic', + ], + 'addfoldersfullpath' => [ + 'name' => 'addfoldersfullpath', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFOLDERSFULLPATH_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_plugins_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Advance', + ], + 'addfilesfullpath' => [ + 'name' => 'addfilesfullpath', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFILESFULLPATH_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_plugins_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Advance', + ], + 'addfolders' => [ + 'name' => 'addfolders', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFOLDERS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_plugins_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Basic', + ], + 'addfiles' => [ + 'name' => 'addfiles', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDFILES_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_plugins_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Basic', + ], + 'addurls' => [ + 'name' => 'addurls', + 'label' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN_FILES_FOLDERS_URLS_ADDURLS_LABEL', + 'type' => 'subform', + 'title' => false, + 'list' => 'joomla_plugins_files_folders_urls', + 'store' => 'json', + 'tab_name' => 'Basic', + ], + ], + ]; +} + diff --git a/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.power b/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.power index 69309b0..ff82257 100644 --- a/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.power +++ b/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.power @@ -1 +1,7 @@ -###CODEPOWER### \ No newline at end of file + /** + * All areas/views/tables with their field details + * + * @var array + * @since 3.2.0 + **/ + protected array $tables = ###ALL_COMPONENT_FIELDS###; \ No newline at end of file diff --git a/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/settings.json b/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/settings.json index 6b3b222..6541f3b 100644 --- a/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/settings.json +++ b/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/settings.json @@ -1 +1,20 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "e0f6ddbe-2a35-4537-942c-faff2ebd04f6", + "guid": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8", + "implements": [ + "2da6d6c4-eb29-4d69-8bc2-36d96e916adf" + ], + "load_selection": null, + "name": "Table", + "power_version": "2.0.0", + "system_name": "JCB.Table", + "type": "class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Componentbuilder.Table", + "description": "JCB Tables\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/c09e8968-c767-4175-bb3d-8432f206a2c7/README.md b/src/c09e8968-c767-4175-bb3d-8432f206a2c7/README.md index 433b69e..c571efc 100644 --- a/src/c09e8968-c767-4175-bb3d-8432f206a2c7/README.md +++ b/src/c09e8968-c767-4175-bb3d-8432f206a2c7/README.md @@ -1 +1,37 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# trait IsArray (Details) +> namespace: **VDM\Joomla\Abstraction\Registry\Traits** +```uml +@startuml +class IsArray << (T,Orange) >> #Turquoise { + + isArray(string $path) : bool +} + +note right of IsArray::isArray + Check if a path is an array + + since: 3.2.0 + return: bool +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/c09e8968-c767-4175-bb3d-8432f206a2c7/code.php b/src/c09e8968-c767-4175-bb3d-8432f206a2c7/code.php index 26c1a50..cdf224b 100644 --- a/src/c09e8968-c767-4175-bb3d-8432f206a2c7/code.php +++ b/src/c09e8968-c767-4175-bb3d-8432f206a2c7/code.php @@ -9,4 +9,40 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction\Registry\Traits; + + +/** + * Check if a value is in an array + * + * @since 3.2.0 + */ +trait IsArray +{ + /** + * Check if a path is an array + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return bool + * @since 3.2.0 + */ + public function isArray(string $path): bool + { + // Check base array if no path is given + if (empty($path)) + { + return false; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_array($node)) + { + return true; + } + + return false; + } +} + diff --git a/src/c09e8968-c767-4175-bb3d-8432f206a2c7/code.power b/src/c09e8968-c767-4175-bb3d-8432f206a2c7/code.power index 69309b0..5ca85be 100644 --- a/src/c09e8968-c767-4175-bb3d-8432f206a2c7/code.power +++ b/src/c09e8968-c767-4175-bb3d-8432f206a2c7/code.power @@ -1 +1,25 @@ -###CODEPOWER### \ No newline at end of file + /** + * Check if a path is an array + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return bool + * @since 3.2.0 + */ + public function isArray(string $path): bool + { + // Check base array if no path is given + if (empty($path)) + { + return false; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_array($node)) + { + return true; + } + + return false; + } \ No newline at end of file diff --git a/src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json b/src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json index 6b3b222..43bdf5c 100644 --- a/src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json +++ b/src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "c09e8968-c767-4175-bb3d-8432f206a2c7", + "implements": null, + "load_selection": null, + "name": "IsArray", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.Registry.Traits.IsArray", + "type": "trait", + "use_selection": null, + "namespace": "VDM\\Joomla\\Abstraction.Registry.Traits.IsArray", + "description": "Check if a value is in an array\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/README.md b/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/README.md index 433b69e..230dfb3 100644 --- a/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/README.md +++ b/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/README.md @@ -1 +1,45 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# interface FactoryInterface (Details) +> namespace: **VDM\Joomla\Interfaces** +```uml +@startuml +interface FactoryInterface #Lavender { + + {static} _(string $key) : Mixed + + {static} getContainer() : Container +} + +note right of FactoryInterface::_ + Get any class from the container + + since: 3.2.0 + return: Mixed +end note + +note right of FactoryInterface::getContainer + Get the global container + + since: 3.2.0 + return: Container +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/code.php b/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/code.php index 26c1a50..0dd2e4c 100644 --- a/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/code.php +++ b/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/code.php @@ -9,4 +9,33 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Interfaces; + + +use Joomla\DI\Container; + + +/** + * The Container Factory Interface + */ +interface FactoryInterface +{ + /** + * Get any class from the container + * + * @param string $key The container class key + * + * @return Mixed + * @since 3.2.0 + */ + public static function _(string $key); + + /** + * Get the global container + * + * @return Container + * @since 3.2.0 + */ + public static function getContainer(): Container; +} + diff --git a/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/code.power b/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/code.power index 69309b0..2b6ce65 100644 --- a/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/code.power +++ b/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/code.power @@ -1 +1,17 @@ -###CODEPOWER### \ No newline at end of file + /** + * Get any class from the container + * + * @param string $key The container class key + * + * @return Mixed + * @since 3.2.0 + */ + public static function _(string $key); + + /** + * Get the global container + * + * @return Container + * @since 3.2.0 + */ + public static function getContainer(): Container; \ No newline at end of file diff --git a/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/settings.json b/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/settings.json index 6b3b222..d062262 100644 --- a/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/settings.json +++ b/src/caf33c5d-858c-4f9a-894f-ab302ec5445a/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "0", + "guid": "caf33c5d-858c-4f9a-894f-ab302ec5445a", + "implements": null, + "load_selection": null, + "name": "FactoryInterface", + "power_version": "1.0.0", + "system_name": "VDM.Interfaces.FactoryInterface", + "type": "interface", + "use_selection": null, + "namespace": "VDM\\Joomla\\Interfaces.FactoryInterface", + "description": "The Container Factory Interface", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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\\DI\\Container;", + "composer": "" +} \ No newline at end of file diff --git a/src/cce56585-58b0-4f72-a92c-e2635ea52d83/README.md b/src/cce56585-58b0-4f72-a92c-e2635ea52d83/README.md index 433b69e..0eefc6a 100644 --- a/src/cce56585-58b0-4f72-a92c-e2635ea52d83/README.md +++ b/src/cce56585-58b0-4f72-a92c-e2635ea52d83/README.md @@ -1 +1,84 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Update (Details) +> namespace: **VDM\Joomla\Database** +> extends: **Database** +```uml +@startuml +class Update << (F,LightGreen) >> #RoyalBlue { + + rows(array $data, string $key, ...) : bool + + items(array $data, string $key, ...) : bool + + row(array $data, string $key, ...) : bool + + item(object $data, string $key, ...) : bool +} + +note right of Update::rows + Update rows in the database (with remapping and filtering columns option) + + since: 3.2.0 + return: bool + + arguments: + array $data + string $key + string $table + array $columns = [] +end note + +note right of Update::items + Update items in the database (with remapping and filtering columns option) + + since: 3.2.0 + return: bool + + arguments: + array $data + string $key + string $table + array $columns = [] +end note + +note right of Update::row + Update row in the database + + since: 3.2.0 + return: bool + + arguments: + array $data + string $key + string $table +end note + +note right of Update::item + Update item in the database + + since: 3.2.0 + return: bool + + arguments: + object $data + string $key + string $table +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.php b/src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.php index 26c1a50..6c4a122 100644 --- a/src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.php +++ b/src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.php @@ -9,4 +9,180 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Database; + + +use VDM\Joomla\Interfaces\UpdateInterface; +use VDM\Joomla\Abstraction\Database; + + +/** + * Database Update Class + * + * @since 3.2.0 + */ +final class Update extends Database implements UpdateInterface +{ + /** + * Update rows in the database (with remapping and filtering columns option) + * + * @param array $data Dataset to update in database [array of arrays (key => value)] + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function rows(array $data, string $key, string $table, array $columns = []): bool + { + // set the update columns + if ($data === [] || strlen($key) == 0) + { + return false; + } + + // set the update values + foreach ($data as $values) + { + if ($columns !== []) + { + // load only what is part of the columns set + $row = []; + foreach ($columns as $column => $key_) + { + if (isset($values[$key_])) + { + $row[$column] = $values[$key_]; + } + } + + // update the row + $this->row($row, $key, $table); + } + else + { + // update the row + $this->row((array) $values, $key, $table); + } + } + + return true; + } + + /** + * Update items in the database (with remapping and filtering columns option) + * + * @param array $data Data to updated in database (array of objects) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being update + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function items(array $data, string $key, string $table, array $columns = []): bool + { + // set the update columns + if ($data === [] || strlen($key) == 0) + { + return false; + } + + // set the update values + foreach ($data as $nr => $values) + { + if ($columns !== []) + { + // load only what is part of the columns set + $row = []; + foreach ($columns as $column => $key_) + { + if (isset($values->{$key_})) + { + $row[$column] = $values->{$key_}; + } + } + + // update the row + $this->row($row, $key, $table); + } + else + { + // update the row + $this->row((array) $values, $key, $table); + } + } + + return true; + } + + /** + * Update row in the database + * + * @param array $data Dataset to update in database (key => value) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * + * @return bool + * @since 3.2.0 + **/ + public function row(array $data, string $key, string $table): bool + { + // set the update columns + if ($data === [] || strlen($key) == 0) + { + return false; + } + + // get a query object + $query = $this->db->getQuery(true); + + // set the query targets + $query->update($this->db->quoteName($this->getTable($table))); + + // set the update values + $key_ = null; + foreach ($data as $column => $value) + { + if ($column === $key) + { + $key_ = $value; + } + else + { + $query->set($this->db->quoteName($column) . ' = ' . $this->quote($value)); + } + } + + // add the key condition + if ($key_ !== null) + { + $query->where($this->db->quoteName($key) . ' = ' . $this->quote($key_)); + + // execute the final query + $this->db->setQuery($query); + + return $this->db->execute(); + } + + return false; + } + + /** + * Update item in the database + * + * @param object $data Dataset to update in database (key => value) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * + * @return bool + * @since 3.2.0 + **/ + public function item(object $data, string $key, string $table): bool + { + // convert to an array + return $this->row((array) get_object_vars($data), $key, $table); + } +} + diff --git a/src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.power b/src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.power index 69309b0..1884e8c 100644 --- a/src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.power +++ b/src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.power @@ -1 +1,161 @@ -###CODEPOWER### \ No newline at end of file + /** + * Update rows in the database (with remapping and filtering columns option) + * + * @param array $data Dataset to update in database [array of arrays (key => value)] + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function rows(array $data, string $key, string $table, array $columns = []): bool + { + // set the update columns + if ($data === [] || strlen($key) == 0) + { + return false; + } + + // set the update values + foreach ($data as $values) + { + if ($columns !== []) + { + // load only what is part of the columns set + $row = []; + foreach ($columns as $column => $key_) + { + if (isset($values[$key_])) + { + $row[$column] = $values[$key_]; + } + } + + // update the row + $this->row($row, $key, $table); + } + else + { + // update the row + $this->row((array) $values, $key, $table); + } + } + + return true; + } + + /** + * Update items in the database (with remapping and filtering columns option) + * + * @param array $data Data to updated in database (array of objects) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being update + * @param array $columns Data columns for remapping and filtering + * + * @return bool + * @since 3.2.0 + **/ + public function items(array $data, string $key, string $table, array $columns = []): bool + { + // set the update columns + if ($data === [] || strlen($key) == 0) + { + return false; + } + + // set the update values + foreach ($data as $nr => $values) + { + if ($columns !== []) + { + // load only what is part of the columns set + $row = []; + foreach ($columns as $column => $key_) + { + if (isset($values->{$key_})) + { + $row[$column] = $values->{$key_}; + } + } + + // update the row + $this->row($row, $key, $table); + } + else + { + // update the row + $this->row((array) $values, $key, $table); + } + } + + return true; + } + + /** + * Update row in the database + * + * @param array $data Dataset to update in database (key => value) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * + * @return bool + * @since 3.2.0 + **/ + public function row(array $data, string $key, string $table): bool + { + // set the update columns + if ($data === [] || strlen($key) == 0) + { + return false; + } + + // get a query object + $query = $this->db->getQuery(true); + + // set the query targets + $query->update($this->db->quoteName($this->getTable($table))); + + // set the update values + $key_ = null; + foreach ($data as $column => $value) + { + if ($column === $key) + { + $key_ = $value; + } + else + { + $query->set($this->db->quoteName($column) . ' = ' . $this->quote($value)); + } + } + + // add the key condition + if ($key_ !== null) + { + $query->where($this->db->quoteName($key) . ' = ' . $this->quote($key_)); + + // execute the final query + $this->db->setQuery($query); + + return $this->db->execute(); + } + + return false; + } + + /** + * Update item in the database + * + * @param object $data Dataset to update in database (key => value) + * @param string $key Dataset key column to use in updating the values in the Database + * @param string $table The table where the data is being updated + * + * @return bool + * @since 3.2.0 + **/ + public function item(object $data, string $key, string $table): bool + { + // convert to an array + return $this->row((array) get_object_vars($data), $key, $table); + } \ No newline at end of file diff --git a/src/cce56585-58b0-4f72-a92c-e2635ea52d83/settings.json b/src/cce56585-58b0-4f72-a92c-e2635ea52d83/settings.json index 6b3b222..02543bf 100644 --- a/src/cce56585-58b0-4f72-a92c-e2635ea52d83/settings.json +++ b/src/cce56585-58b0-4f72-a92c-e2635ea52d83/settings.json @@ -1 +1,20 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "6cbef8f8-4813-48e3-b05a-65e1aea95171", + "guid": "cce56585-58b0-4f72-a92c-e2635ea52d83", + "implements": [ + "7179fde6-1e51-4b51-8545-7ca18f74a0f4" + ], + "load_selection": null, + "name": "Update", + "power_version": "1.0.0", + "system_name": "VDM.Database.Update", + "type": "final class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Database.Update", + "description": "Database Update Class\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/cddcac51-9a46-47c4-ba59-105c70453bd6/README.md b/src/cddcac51-9a46-47c4-ba59-105c70453bd6/README.md index 433b69e..0745f45 100644 --- a/src/cddcac51-9a46-47c4-ba59-105c70453bd6/README.md +++ b/src/cddcac51-9a46-47c4-ba59-105c70453bd6/README.md @@ -1 +1,157 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class FilterHelper (Details) +> namespace: **VDM\Joomla\Componentbuilder\Utilities** +```uml +@startuml +abstract FilterHelper #Orange { + + {static} extensions() : string + + {static} names(string $type, ?string $limiter = null) : ?array + + {static} linked(int $id, string $method) : ?array + + {static} namespaces() : ?array + + {static} namegroup(string $namespace) : ?array + + {static} translation(int $extension, string $type) : ?array + + {static} translations($language, $translated = true) : ?array + + {static} languages() : ?array + + {static} paths(string $path) : ?array + - {static} joomla_component_admin_views(int $id) : ?array + - {static} joomla_component_custom_admin_views(int $id) : ?array + - {static} joomla_component_site_views(int $id) : ?array + - {static} joomla_component(int $id) : ?array + - {static} joomla_module(int $id) : ?array + - {static} joomla_plugin(int $id) : ?array + - {static} admin_view(int $id) : ?array +} + +note right of FilterHelper::extensions + get extensions grouped list xml + + since: 3.2.0 + return: string +end note + +note left of FilterHelper::names + Get by type the ids and system names + + since: 3.2.0 + return: ?array +end note + +note right of FilterHelper::linked + get any area linked IDs + + since: 3.2.0 + return: ?array +end note + +note left of FilterHelper::namespaces + get the substrings of the namespace until the last "\" or "." + + since: 3.2.0 + return: ?array +end note + +note right of FilterHelper::namegroup + get get IDs of powers matching namespaces + + since: 3.2.0 + return: ?array +end note + +note left of FilterHelper::translation + get translation extension ids + + since: 3.2.0 + return: ?array +end note + +note right of FilterHelper::translations + get translation ids + + since: 3.2.0 + return: ?array +end note + +note left of FilterHelper::languages + get available languages + + since: 3.2.0 + return: ?array +end note + +note right of FilterHelper::paths + get get IDs of powers link to this path + + since: 3.2.0 + return: ?array +end note + +note left of FilterHelper::joomla_component_admin_views + Get a component admin views IDs + + since: 3.2.0 + return: ?array +end note + +note right of FilterHelper::joomla_component_custom_admin_views + get a component custom admin views IDs + + since: 3.2.0 + return: ?array +end note + +note left of FilterHelper::joomla_component_site_views + get a component site views IDs + + since: 3.2.0 + return: ?array +end note + +note right of FilterHelper::joomla_component + get a component fields IDs + + since: 3.2.0 + return: ?array +end note + +note left of FilterHelper::joomla_module + get a module fields IDs + + since: 3.2.0 + return: ?array +end note + +note right of FilterHelper::joomla_plugin + get a plugin fields IDs + + since: 3.2.0 + return: ?array +end note + +note left of FilterHelper::admin_view + get an admin view fields IDs + + since: 3.2.0 + return: ?array +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.php b/src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.php index 26c1a50..86dec4d 100644 --- a/src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.php +++ b/src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.php @@ -9,4 +9,806 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Componentbuilder\Utilities; + + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\GetHelper; + + +/** + * Filter Helper + * + * @since 3.2.0 + */ +abstract class FilterHelper +{ + /** + * get extensions grouped list xml + * + * @return string The XML string of Extentions + * @since 3.2.0 + */ + public static function extensions(): string + { + // the extension types + $extensions = array( + 'joomla_component' => 'COM_COMPONENTBUILDER_COMPONENT', + 'joomla_module' => 'COM_COMPONENTBUILDER_MODULE', + 'joomla_plugin' => 'COM_COMPONENTBUILDER_PLUGIN' + ); + + // get the extension values + foreach ($extensions as $extension => $label) + { + ${$extension} = self::names($extension); + } + + $xml = new \DOMDocument(); + $xml->formatOutput = true; + + $root = $xml->createElement('field'); + $root->setAttributeNode(new \DOMAttr('name', 'extension')); + $root->setAttributeNode(new \DOMAttr('type', 'groupedlist')); + $root->setAttributeNode(new \DOMAttr('onchange', 'this.form.submit();')); + + $root + ->appendChild($xml->createElement('option', '- ' . Text::_('COM_COMPONENTBUILDER_SELECT_EXTENSION') . ' -')) + ->setAttributeNode(new \DOMAttr('value', '')); + + foreach ($extensions as $extension => $label) + { + $extension_node = $xml->createElement('group'); + $extension_node->setAttributeNode(new \DOMAttr('label', $label)); + if (!ArrayHelper::check(${$extension})) + { + $extension_node + ->appendChild($xml->createElement('option', '- ' . Text::_('COM_COMPONENTBUILDER_NONE') . ' -')) + ->setAttributeNode(new \DOMAttr('disabled', 'true')); + } + else + { + foreach (${$extension} as $id => $element) + { + $extension_node + ->appendChild($xml->createElement('option', $element)) + ->setAttributeNode(new \DOMAttr('value', $extension . '__' . $id)); + } + } + $root->appendChild($extension_node); + } + $xml->appendChild($root); + + return $xml->saveXML(); + } + + /** + * Get by type the ids and system names + * + * @param string $type The table name to get system names for + * @param string|null $limiter The to limit by limiter table + * + * @return array|null The array of system name and IDs + * @since 3.2.0 + */ + public static function names(string $type, ?string $limiter = null): ?array + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('id', 'system_name'))) + ->from($db->quoteName('#__componentbuilder_' . $type)) + ->where($db->quoteName('published') . ' >= 1') + ->order($db->quoteName('modified') . ' desc') + ->order($db->quoteName('created') . ' desc'); + + // check if we have a limiter for admin views + if ($type === 'admin_view' && $limiter) + { + // first get all views + $admin_view_ids = array(); + + // if this is a plugin or a module, then no views + if (strpos($limiter, 'joomla_component') !== false) + { + $component = (int) str_replace('joomla_component__', '', $limiter); + // get the views of this component + if ($add_views = GetHelper::var('component_admin_views', (int) $component, 'joomla_component', 'addadmin_views')) + { + if (JsonHelper::check($add_views)) + { + $add_views = json_decode($add_views, true); + if (ArrayHelper::check($add_views)) + { + foreach($add_views as $add_view) + { + if (isset($add_view['adminview'])) + { + $admin_view_ids[(int) $add_view['adminview']] = (int) $add_view['adminview']; + } + } + } + } + } + } + // now check if we still have admin views + if (ArrayHelper::check($admin_view_ids)) + { + $query->where($db->quoteName('id') . ' IN (' . implode(',', $admin_view_ids) . ')'); + } + else + { + return null; + } + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadAssocList('id', 'system_name'); + } + + return null; + } + + /** + * get any area linked IDs + * + * @param int $id The target ID + * @param string $method The target method + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function linked(int $id, string $method): ?array + { + // check if method exist + if (method_exists(__CLASS__, $method)) + { + return self::{$method}($id); + } + + return null; + } + + /** + * get the substrings of the namespace until the last "\" or "." + * + * @return array|null The result substrings + * @since 3.2.0 + **/ + public static function namespaces(): ?array + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query + ->select( + 'DISTINCT REPLACE(SUBSTRING(' + . $db->quoteName('namespace') + . ', 1, LENGTH(' + . $db->quoteName('namespace') + . ') - LEAST(' + . 'IF(LOCATE(' + . $db->quote('\\') + . ', ' . $db->quoteName('namespace') + . ') > 0, LOCATE(' + . $db->quote('\\') + . ', REVERSE(' + . $db->quoteName('namespace') + . ')), 0), ' + . 'IF(LOCATE(' + . $db->quote('.') + . ', ' . $db->quoteName('namespace') + . ') > 0, LOCATE(' + . $db->quote('.') + . ', REVERSE(' + . $db->quoteName('namespace') + . ')), 0))), ".", "\\\") AS trimmed_namespace' + ) + ->from($db->quoteName('#__componentbuilder_power')) + ->where($db->quoteName('published') . ' = 1') + ->order('LENGTH(trimmed_namespace) ASC, trimmed_namespace ASC'); + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadAssocList('trimmed_namespace', 'trimmed_namespace'); + } + + return null; + } + + /** + * get get IDs of powers matching namespaces + * + * @param string $namespace The target namespace + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function namegroup(string $namespace): ?array + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query + ->select($db->quoteName(array('id'))) + ->from($db->quoteName('#__componentbuilder_power')) + ->where($db->quoteName('published') . ' = 1'); + + // we get only those that match the owner and repo (smaller set) + $paths = explode('\\', $namespace); + foreach ($paths as $path) + { + $query->where($db->quoteName('namespace') . ' REGEXP ' . $db->quote($path)); + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadColumn(); + } + + return null; + } + + /** + * get translation extension ids + * + * @param int $extension The target ID + * @param string $type The target method + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function translation(int $extension, string $type): ?array + { + // only allow these columns (extension types) + $columns = array( + 'joomla_component' => 'components', + 'joomla_module' => 'modules', + 'joomla_plugin' => 'plugins' + ); + + // check if the column name is correct + if (isset($columns[$type])) + { + $column = $columns[$type]; + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query + ->select($db->quoteName(array('id', $column))) + ->from($db->quoteName('#__componentbuilder_language_translation')) + ->where($db->quoteName($column) . ' != ' . $db->quote('')); + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + $results = $db->loadAssocList(); + $matches = []; + foreach ($results as $k => $v) + { + $value = json_decode($v[$column], true); + if (in_array($extension, $value)) + { + $matches[$v['id']] = $v['id']; + } + } + + // Checks that we found matches + if (ArrayHelper::check($matches)) + { + return array_values($matches); + } + } + } + + return null; + } + + /** + * get translation ids + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function translations($language, $translated = true): ?array + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName('id')) + ->from($db->quoteName('#__componentbuilder_language_translation')); + + // Build the where condition + if ($translated === true) // Translated + { + if ($language === 'all') + { + if (($languages = self::languages()) !== null) + { + $wheres = []; + foreach ($languages as $k => $v) + { + $wheres[] = $db->quoteName('translation') . ' LIKE ' . $db->quote('%' . $k . '%'); + } + $query->where($wheres); + } + } + else + { + $query->where($db->quoteName('translation') . ' LIKE ' . $db->quote('%' . $language . '%')); + } + } + else // Not translated + { + if ($language === 'none') + { + $query->where( + array( + $db->quoteName('translation') . ' = ' . $db->quote(''), + $db->quoteName('translation') . ' = ' . $db->quote('[]'), + $db->quoteName('translation') . ' = ' . $db->quote('{}') + ), 'OR' + ); + } + else + { + $query->where($db->quoteName('translation') . ' NOT LIKE ' . $db->quote('%' . $language . '%')); + } + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return array_unique($db->loadColumn()); + } + + return null; + } + + /** + * get available languages + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function languages(): ?array + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query + ->select($db->quoteName(array('langtag', 'name'))) + ->from($db->quoteName('#__componentbuilder_language')) + ->where($db->quoteName('published') . ' = 1') + ->order($db->quoteName('name') . ' desc'); + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadAssocList('langtag', 'name'); + } + + return null; + } + + /** + * get get IDs of powers link to this path + * + * @param string $path The target PATH + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function paths(string $path): ?array + { + // get all this power ids + $ids = []; + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query + ->select($db->quoteName(array('id', 'approved_paths'))) + ->from($db->quoteName('#__componentbuilder_power')) + ->where($db->quoteName('published') . ' = 1'); + + // we get only those that match the owner and repo (smaller set) + if (($pos = strpos($path, '/')) !== false) + { + $owner = substr($path, 0, $pos); + $repo = substr($path, $pos + 1); + $query + ->where($db->quoteName('approved_paths') . ' REGEXP ' . $db->quote($owner)) + ->where($db->quoteName('approved_paths') . ' REGEXP ' . $db->quote($repo)); + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + $result = $db->loadAssocList('id', 'approved_paths'); + foreach ($result as $id => $paths) + { + if (JsonHelper::check($paths)) + { + $paths = json_decode($paths, true); + if (ArrayHelper::check($paths) && in_array($path, $paths, true)) + { + $ids[$id] = $id; + } + } + } + + if (ArrayHelper::check($ids)) + { + return $ids; + } + } + + return null; + } + + /** + * Get a component admin views IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_component_admin_views(int $id): ?array + { + // get all this components views + $admin_view_ids = []; + + // get the views of this component + if ($add_views = GetHelper::var('component_admin_views', (int) $id, 'joomla_component', 'addadmin_views')) + { + if (JsonHelper::check($add_views)) + { + $add_views = json_decode($add_views, true); + if (ArrayHelper::check($add_views)) + { + foreach($add_views as $add_view) + { + if (isset($add_view['adminview'])) + { + $admin_view_ids[(int) $add_view['adminview']] = (int) $add_view['adminview']; + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($admin_view_ids)) + { + return array_values($admin_view_ids); + } + + return null; + } + + /** + * get a component custom admin views IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_component_custom_admin_views($id): ?array + { + // get all this components views + $admin_view_ids = []; + + // get the views of this component + if ($add_views = GetHelper::var('component_custom_admin_views', (int) $id, 'joomla_component', 'addcustom_admin_views')) + { + if (JsonHelper::check($add_views)) + { + $add_views = json_decode($add_views, true); + if (ArrayHelper::check($add_views)) + { + foreach($add_views as $add_view) + { + if (isset($add_view['customadminview'])) + { + $admin_view_ids[(int) $add_view['customadminview']] = (int) $add_view['customadminview']; + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($admin_view_ids)) + { + return array_values($admin_view_ids); + } + + return null; + } + + /** + * get a component site views IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_component_site_views($id): ?array + { + // get all this components views + $admin_view_ids = []; + + // get the views of this component + if ($add_views = GetHelper::var('component_site_views', (int) $id, 'joomla_component', 'addsite_views')) + { + if (JsonHelper::check($add_views)) + { + $add_views = json_decode($add_views, true); + if (ArrayHelper::check($add_views)) + { + foreach($add_views as $add_view) + { + if (isset($add_view['siteview'])) + { + $admin_view_ids[(int) $add_view['siteview']] = (int) $add_view['siteview']; + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($admin_view_ids)) + { + return array_values($admin_view_ids); + } + + return null; + } + + /** + * get a component fields IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_component($id): ?array + { + // we start the field array + $field_ids = []; + + // first get all views + $admin_view_ids = []; + + // get the views of this component + if ($add_views = GetHelper::var('component_admin_views', (int) $id, 'joomla_component', 'addadmin_views')) + { + if (JsonHelper::check($add_views)) + { + $add_views = json_decode($add_views, true); + if (ArrayHelper::check($add_views)) + { + foreach($add_views as $add_view) + { + if (isset($add_view['adminview'])) + { + $admin_view_ids[(int) $add_view['adminview']] = (int) $add_view['adminview']; + } + } + } + } + } + + // check that we have views + if (ArrayHelper::check($admin_view_ids)) + { + foreach ($admin_view_ids as $admin_view) + { + // get all the fields linked to the admin view + if ($add_fields = GetHelper::var('admin_fields', (int) $admin_view, 'admin_view', 'addfields')) + { + if (JsonHelper::check($add_fields)) + { + $add_fields = json_decode($add_fields, true); + if (ArrayHelper::check($add_fields)) + { + foreach($add_fields as $add_field) + { + if (isset($add_field['field'])) + { + $field_ids[(int) $add_field['field']] = (int) $add_field['field']; + } + } + } + } + } + } + } + + // get config values + if ($add_config = GetHelper::var('component_config', (int) $id, 'joomla_component', 'addconfig')) + { + if (JsonHelper::check($add_config)) + { + $add_config = json_decode($add_config, true); + if (ArrayHelper::check($add_config)) + { + foreach($add_config as $add_conf) + { + if (isset($add_conf['field'])) + { + $field_ids[(int) $add_conf['field']] = (int) $add_conf['field']; + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($field_ids)) + { + return array_values($field_ids); + } + + return null; + } + + /** + * get a module fields IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_module($id): ?array + { + // we start the field array + $field_ids = []; + + if ($fields = GetHelper::var('joomla_module', (int) $id, 'id', 'fields')) + { + if (JsonHelper::check($fields)) + { + $fields = json_decode($fields, true); + if (ArrayHelper::check($fields)) + { + foreach($fields as $form) + { + if (isset($form['fields']) && ArrayHelper::check($form['fields'])) + { + foreach ($form['fields'] as $field) + { + if (isset($field['field'])) + { + $field_ids[(int) $field['field']] = (int) $field['field']; + } + } + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($field_ids)) + { + return array_values($field_ids); + } + + return null; + } + + /** + * get a plugin fields IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_plugin($id): ?array + { + // we start the field array + $field_ids = []; + + if ($fields = GetHelper::var('joomla_plugin', (int) $id, 'id', 'fields')) + { + if (JsonHelper::check($fields)) + { + $fields = json_decode($fields, true); + if (ArrayHelper::check($fields)) + { + foreach($fields as $form) + { + if (isset($form['fields']) && ArrayHelper::check($form['fields'])) + { + foreach ($form['fields'] as $field) + { + if (isset($field['field'])) + { + $field_ids[(int) $field['field']] = (int) $field['field']; + } + } + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($field_ids)) + { + return array_values($field_ids); + } + + return null; + } + + /** + * get an admin view fields IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function admin_view($id): ?array + { + // we start the field array + $field_ids = []; + + // get all the fields linked to the admin view + if ($add_fields = GetHelper::var('admin_fields', (int) $id, 'admin_view', 'addfields')) + { + if (JsonHelper::check($add_fields)) + { + $add_fields = json_decode($add_fields, true); + if (ArrayHelper::check($add_fields)) + { + foreach($add_fields as $add_field) + { + if (isset($add_field['field'])) + { + $field_ids[(int) $add_field['field']] = (int) $add_field['field']; + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($field_ids)) + { + return array_values($field_ids); + } + + return null; + } + +} + diff --git a/src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.power b/src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.power index 69309b0..7c565d5 100644 --- a/src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.power +++ b/src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.power @@ -1 +1,783 @@ -###CODEPOWER### \ No newline at end of file + /** + * get extensions grouped list xml + * + * @return string The XML string of Extentions + * @since 3.2.0 + */ + public static function extensions(): string + { + // the extension types + $extensions = array( + 'joomla_component' => JustTEXT::_('Component'), + 'joomla_module' => JustTEXT::_('Module'), + 'joomla_plugin' => JustTEXT::_('Plugin') + ); + + // get the extension values + foreach ($extensions as $extension => $label) + { + ${$extension} = self::names($extension); + } + + $xml = new \DOMDocument(); + $xml->formatOutput = true; + + $root = $xml->createElement('field'); + $root->setAttributeNode(new \DOMAttr('name', 'extension')); + $root->setAttributeNode(new \DOMAttr('type', 'groupedlist')); + $root->setAttributeNode(new \DOMAttr('onchange', 'this.form.submit();')); + + $root + ->appendChild($xml->createElement('option', '- ' . Text::_('Select Extension') . ' -')) + ->setAttributeNode(new \DOMAttr('value', '')); + + foreach ($extensions as $extension => $label) + { + $extension_node = $xml->createElement('group'); + $extension_node->setAttributeNode(new \DOMAttr('label', $label)); + if (!ArrayHelper::check(${$extension})) + { + $extension_node + ->appendChild($xml->createElement('option', '- ' . Text::_('None') . ' -')) + ->setAttributeNode(new \DOMAttr('disabled', 'true')); + } + else + { + foreach (${$extension} as $id => $element) + { + $extension_node + ->appendChild($xml->createElement('option', $element)) + ->setAttributeNode(new \DOMAttr('value', $extension . '__' . $id)); + } + } + $root->appendChild($extension_node); + } + $xml->appendChild($root); + + return $xml->saveXML(); + } + + /** + * Get by type the ids and system names + * + * @param string $type The table name to get system names for + * @param string|null $limiter The to limit by limiter table + * + * @return array|null The array of system name and IDs + * @since 3.2.0 + */ + public static function names(string $type, ?string $limiter = null): ?array + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName(array('id', 'system_name'))) + ->from($db->quoteName('#__componentbuilder_' . $type)) + ->where($db->quoteName('published') . ' >= 1') + ->order($db->quoteName('modified') . ' desc') + ->order($db->quoteName('created') . ' desc'); + + // check if we have a limiter for admin views + if ($type === 'admin_view' && $limiter) + { + // first get all views + $admin_view_ids = array(); + + // if this is a plugin or a module, then no views + if (strpos($limiter, 'joomla_component') !== false) + { + $component = (int) str_replace('joomla_component__', '', $limiter); + // get the views of this component + if ($add_views = GetHelper::var('component_admin_views', (int) $component, 'joomla_component', 'addadmin_views')) + { + if (JsonHelper::check($add_views)) + { + $add_views = json_decode($add_views, true); + if (ArrayHelper::check($add_views)) + { + foreach($add_views as $add_view) + { + if (isset($add_view['adminview'])) + { + $admin_view_ids[(int) $add_view['adminview']] = (int) $add_view['adminview']; + } + } + } + } + } + } + // now check if we still have admin views + if (ArrayHelper::check($admin_view_ids)) + { + $query->where($db->quoteName('id') . ' IN (' . implode(',', $admin_view_ids) . ')'); + } + else + { + return null; + } + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadAssocList('id', 'system_name'); + } + + return null; + } + + /** + * get any area linked IDs + * + * @param int $id The target ID + * @param string $method The target method + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function linked(int $id, string $method): ?array + { + // check if method exist + if (method_exists(__CLASS__, $method)) + { + return self::{$method}($id); + } + + return null; + } + + /** + * get the substrings of the namespace until the last "\" or "." + * + * @return array|null The result substrings + * @since 3.2.0 + **/ + public static function namespaces(): ?array + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query + ->select( + 'DISTINCT REPLACE(SUBSTRING(' + . $db->quoteName('namespace') + . ', 1, LENGTH(' + . $db->quoteName('namespace') + . ') - LEAST(' + . 'IF(LOCATE(' + . $db->quote('\\') + . ', ' . $db->quoteName('namespace') + . ') > 0, LOCATE(' + . $db->quote('\\') + . ', REVERSE(' + . $db->quoteName('namespace') + . ')), 0), ' + . 'IF(LOCATE(' + . $db->quote('.') + . ', ' . $db->quoteName('namespace') + . ') > 0, LOCATE(' + . $db->quote('.') + . ', REVERSE(' + . $db->quoteName('namespace') + . ')), 0))), ".", "\\\") AS trimmed_namespace' + ) + ->from($db->quoteName('#__componentbuilder_power')) + ->where($db->quoteName('published') . ' = 1') + ->order('LENGTH(trimmed_namespace) ASC, trimmed_namespace ASC'); + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadAssocList('trimmed_namespace', 'trimmed_namespace'); + } + + return null; + } + + /** + * get get IDs of powers matching namespaces + * + * @param string $namespace The target namespace + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function namegroup(string $namespace): ?array + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query + ->select($db->quoteName(array('id'))) + ->from($db->quoteName('#__componentbuilder_power')) + ->where($db->quoteName('published') . ' = 1'); + + // we get only those that match the owner and repo (smaller set) + $paths = explode('\\', $namespace); + foreach ($paths as $path) + { + $query->where($db->quoteName('namespace') . ' REGEXP ' . $db->quote($path)); + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadColumn(); + } + + return null; + } + + /** + * get translation extension ids + * + * @param int $extension The target ID + * @param string $type The target method + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function translation(int $extension, string $type): ?array + { + // only allow these columns (extension types) + $columns = array( + 'joomla_component' => 'components', + 'joomla_module' => 'modules', + 'joomla_plugin' => 'plugins' + ); + + // check if the column name is correct + if (isset($columns[$type])) + { + $column = $columns[$type]; + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query + ->select($db->quoteName(array('id', $column))) + ->from($db->quoteName('#__componentbuilder_language_translation')) + ->where($db->quoteName($column) . ' != ' . $db->quote('')); + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + $results = $db->loadAssocList(); + $matches = []; + foreach ($results as $k => $v) + { + $value = json_decode($v[$column], true); + if (in_array($extension, $value)) + { + $matches[$v['id']] = $v['id']; + } + } + + // Checks that we found matches + if (ArrayHelper::check($matches)) + { + return array_values($matches); + } + } + } + + return null; + } + + /** + * get translation ids + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function translations($language, $translated = true): ?array + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query + ->select($db->quoteName('id')) + ->from($db->quoteName('#__componentbuilder_language_translation')); + + // Build the where condition + if ($translated === true) // Translated + { + if ($language === 'all') + { + if (($languages = self::languages()) !== null) + { + $wheres = []; + foreach ($languages as $k => $v) + { + $wheres[] = $db->quoteName('translation') . ' LIKE ' . $db->quote('%' . $k . '%'); + } + $query->where($wheres); + } + } + else + { + $query->where($db->quoteName('translation') . ' LIKE ' . $db->quote('%' . $language . '%')); + } + } + else // Not translated + { + if ($language === 'none') + { + $query->where( + array( + $db->quoteName('translation') . ' = ' . $db->quote(''), + $db->quoteName('translation') . ' = ' . $db->quote('[]'), + $db->quoteName('translation') . ' = ' . $db->quote('{}') + ), 'OR' + ); + } + else + { + $query->where($db->quoteName('translation') . ' NOT LIKE ' . $db->quote('%' . $language . '%')); + } + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return array_unique($db->loadColumn()); + } + + return null; + } + + /** + * get available languages + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function languages(): ?array + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query + ->select($db->quoteName(array('langtag', 'name'))) + ->from($db->quoteName('#__componentbuilder_language')) + ->where($db->quoteName('published') . ' = 1') + ->order($db->quoteName('name') . ' desc'); + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadAssocList('langtag', 'name'); + } + + return null; + } + + /** + * get get IDs of powers link to this path + * + * @param string $path The target PATH + * + * @return array|null The result ids + * @since 3.2.0 + **/ + public static function paths(string $path): ?array + { + // get all this power ids + $ids = []; + + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query + ->select($db->quoteName(array('id', 'approved_paths'))) + ->from($db->quoteName('#__componentbuilder_power')) + ->where($db->quoteName('published') . ' = 1'); + + // we get only those that match the owner and repo (smaller set) + if (($pos = strpos($path, '/')) !== false) + { + $owner = substr($path, 0, $pos); + $repo = substr($path, $pos + 1); + $query + ->where($db->quoteName('approved_paths') . ' REGEXP ' . $db->quote($owner)) + ->where($db->quoteName('approved_paths') . ' REGEXP ' . $db->quote($repo)); + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + $result = $db->loadAssocList('id', 'approved_paths'); + foreach ($result as $id => $paths) + { + if (JsonHelper::check($paths)) + { + $paths = json_decode($paths, true); + if (ArrayHelper::check($paths) && in_array($path, $paths, true)) + { + $ids[$id] = $id; + } + } + } + + if (ArrayHelper::check($ids)) + { + return $ids; + } + } + + return null; + } + + /** + * Get a component admin views IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_component_admin_views(int $id): ?array + { + // get all this components views + $admin_view_ids = []; + + // get the views of this component + if ($add_views = GetHelper::var('component_admin_views', (int) $id, 'joomla_component', 'addadmin_views')) + { + if (JsonHelper::check($add_views)) + { + $add_views = json_decode($add_views, true); + if (ArrayHelper::check($add_views)) + { + foreach($add_views as $add_view) + { + if (isset($add_view['adminview'])) + { + $admin_view_ids[(int) $add_view['adminview']] = (int) $add_view['adminview']; + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($admin_view_ids)) + { + return array_values($admin_view_ids); + } + + return null; + } + + /** + * get a component custom admin views IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_component_custom_admin_views($id): ?array + { + // get all this components views + $admin_view_ids = []; + + // get the views of this component + if ($add_views = GetHelper::var('component_custom_admin_views', (int) $id, 'joomla_component', 'addcustom_admin_views')) + { + if (JsonHelper::check($add_views)) + { + $add_views = json_decode($add_views, true); + if (ArrayHelper::check($add_views)) + { + foreach($add_views as $add_view) + { + if (isset($add_view['customadminview'])) + { + $admin_view_ids[(int) $add_view['customadminview']] = (int) $add_view['customadminview']; + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($admin_view_ids)) + { + return array_values($admin_view_ids); + } + + return null; + } + + /** + * get a component site views IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_component_site_views($id): ?array + { + // get all this components views + $admin_view_ids = []; + + // get the views of this component + if ($add_views = GetHelper::var('component_site_views', (int) $id, 'joomla_component', 'addsite_views')) + { + if (JsonHelper::check($add_views)) + { + $add_views = json_decode($add_views, true); + if (ArrayHelper::check($add_views)) + { + foreach($add_views as $add_view) + { + if (isset($add_view['siteview'])) + { + $admin_view_ids[(int) $add_view['siteview']] = (int) $add_view['siteview']; + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($admin_view_ids)) + { + return array_values($admin_view_ids); + } + + return null; + } + + /** + * get a component fields IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_component($id): ?array + { + // we start the field array + $field_ids = []; + + // first get all views + $admin_view_ids = []; + + // get the views of this component + if ($add_views = GetHelper::var('component_admin_views', (int) $id, 'joomla_component', 'addadmin_views')) + { + if (JsonHelper::check($add_views)) + { + $add_views = json_decode($add_views, true); + if (ArrayHelper::check($add_views)) + { + foreach($add_views as $add_view) + { + if (isset($add_view['adminview'])) + { + $admin_view_ids[(int) $add_view['adminview']] = (int) $add_view['adminview']; + } + } + } + } + } + + // check that we have views + if (ArrayHelper::check($admin_view_ids)) + { + foreach ($admin_view_ids as $admin_view) + { + // get all the fields linked to the admin view + if ($add_fields = GetHelper::var('admin_fields', (int) $admin_view, 'admin_view', 'addfields')) + { + if (JsonHelper::check($add_fields)) + { + $add_fields = json_decode($add_fields, true); + if (ArrayHelper::check($add_fields)) + { + foreach($add_fields as $add_field) + { + if (isset($add_field['field'])) + { + $field_ids[(int) $add_field['field']] = (int) $add_field['field']; + } + } + } + } + } + } + } + + // get config values + if ($add_config = GetHelper::var('component_config', (int) $id, 'joomla_component', 'addconfig')) + { + if (JsonHelper::check($add_config)) + { + $add_config = json_decode($add_config, true); + if (ArrayHelper::check($add_config)) + { + foreach($add_config as $add_conf) + { + if (isset($add_conf['field'])) + { + $field_ids[(int) $add_conf['field']] = (int) $add_conf['field']; + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($field_ids)) + { + return array_values($field_ids); + } + + return null; + } + + /** + * get a module fields IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_module($id): ?array + { + // we start the field array + $field_ids = []; + + if ($fields = GetHelper::var('joomla_module', (int) $id, 'id', 'fields')) + { + if (JsonHelper::check($fields)) + { + $fields = json_decode($fields, true); + if (ArrayHelper::check($fields)) + { + foreach($fields as $form) + { + if (isset($form['fields']) && ArrayHelper::check($form['fields'])) + { + foreach ($form['fields'] as $field) + { + if (isset($field['field'])) + { + $field_ids[(int) $field['field']] = (int) $field['field']; + } + } + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($field_ids)) + { + return array_values($field_ids); + } + + return null; + } + + /** + * get a plugin fields IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function joomla_plugin($id): ?array + { + // we start the field array + $field_ids = []; + + if ($fields = GetHelper::var('joomla_plugin', (int) $id, 'id', 'fields')) + { + if (JsonHelper::check($fields)) + { + $fields = json_decode($fields, true); + if (ArrayHelper::check($fields)) + { + foreach($fields as $form) + { + if (isset($form['fields']) && ArrayHelper::check($form['fields'])) + { + foreach ($form['fields'] as $field) + { + if (isset($field['field'])) + { + $field_ids[(int) $field['field']] = (int) $field['field']; + } + } + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($field_ids)) + { + return array_values($field_ids); + } + + return null; + } + + /** + * get an admin view fields IDs + * + * @param int $id The target ID + * + * @return array|null The result ids + * @since 3.2.0 + */ + private static function admin_view($id): ?array + { + // we start the field array + $field_ids = []; + + // get all the fields linked to the admin view + if ($add_fields = GetHelper::var('admin_fields', (int) $id, 'admin_view', 'addfields')) + { + if (JsonHelper::check($add_fields)) + { + $add_fields = json_decode($add_fields, true); + if (ArrayHelper::check($add_fields)) + { + foreach($add_fields as $add_field) + { + if (isset($add_field['field'])) + { + $field_ids[(int) $add_field['field']] = (int) $add_field['field']; + } + } + } + } + } + + // check that we have fields + if (ArrayHelper::check($field_ids)) + { + return array_values($field_ids); + } + + return null; + } diff --git a/src/cddcac51-9a46-47c4-ba59-105c70453bd6/settings.json b/src/cddcac51-9a46-47c4-ba59-105c70453bd6/settings.json index 6b3b222..0366781 100644 --- a/src/cddcac51-9a46-47c4-ba59-105c70453bd6/settings.json +++ b/src/cddcac51-9a46-47c4-ba59-105c70453bd6/settings.json @@ -1 +1,31 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "0", + "guid": "cddcac51-9a46-47c4-ba59-105c70453bd6", + "implements": null, + "load_selection": null, + "name": "FilterHelper", + "power_version": "1.0.0", + "system_name": "JCB.Utilities.FilterHelper", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a", + "as": "default" + }, + "use_selection1": { + "use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18", + "as": "default" + }, + "use_selection2": { + "use": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Componentbuilder.Utilities.FilterHelper", + "description": "Filter Helper\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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\\CMS\\Factory;\r\nuse Joomla\\CMS\\Language\\Text;", + "composer": "" +} \ No newline at end of file diff --git a/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/README.md b/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/README.md index 433b69e..8712e31 100644 --- a/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/README.md +++ b/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/README.md @@ -1 +1,45 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class NamespaceHelper (Details) +> namespace: **VDM\Joomla\Utilities\String** +```uml +@startuml +abstract NamespaceHelper #Orange { + + {static} safe(string $string) : string + + {static} safeSegment(string $string) : string +} + +note right of NamespaceHelper::safe + Making namespace 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 +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/code.php b/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/code.php index b9a864e..55ee2e4 100644 --- a/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/code.php +++ b/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/code.php @@ -9,4 +9,70 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities\String; + + +use VDM\Joomla\Utilities\StringHelper; + + +/** + * Control the naming of a namespace helper + * + * @since 3.0.9 + */ +abstract class NamespaceHelper +{ + /** + * Making namespace safe + * + * @param string $string The namespace string you would like to make safe + * + * @return string on success + * @since 3.0.9 + */ + public static function safe(string $string): string + { + // Remove leading and trailing backslashes + $string = trim($string, '\\'); + + // Split the string into namespace segments + $segments = explode('\\', $string); + + // 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); + } +} + diff --git a/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/code.power b/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/code.power index 69309b0..92d1989 100644 --- a/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/code.power +++ b/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/code.power @@ -1 +1,52 @@ -###CODEPOWER### \ No newline at end of file + /** + * Making namespace safe + * + * @param string $string The namespace string you would like to make safe + * + * @return string on success + * @since 3.0.9 + */ + public static function safe(string $string): string + { + // Remove leading and trailing backslashes + $string = trim($string, '\\'); + + // Split the string into namespace segments + $segments = explode('\\', $string); + + // 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); + } \ No newline at end of file diff --git a/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/settings.json b/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/settings.json index 6b3b222..c504c3b 100644 --- a/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/settings.json +++ b/src/ce8cf834-6bac-44fb-941c-861f7e046cc0/settings.json @@ -1 +1,23 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "ce8cf834-6bac-44fb-941c-861f7e046cc0", + "implements": null, + "load_selection": null, + "name": "NamespaceHelper", + "power_version": "1.0.0", + "system_name": "String Namespace Helper", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Utilities.String.NamespaceHelper", + "description": "Control the naming of a namespace helper\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/README.md b/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/README.md index 433b69e..6176d89 100644 --- a/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/README.md +++ b/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/README.md @@ -1 +1,89 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class GetHelper (Details) +> namespace: **VDM\Joomla\Utilities** +```uml +@startuml +abstract GetHelper #Orange { + + {static} var(?string $table = null, mixed $where = null, ...) : mixed + + {static} vars(?string $table = null, mixed $where = null, ...) : ?array + + {static} allBetween(string $content, string $start, ...) : ?array + + {static} between(string $content, string $start, ...) : string +} + +note right of GetHelper::var + Get a Variable + + since: 3.0.9 + return: mixed + + arguments: + ?string $table = null + mixed $where = null + string $whereString = 'user' + string $what = 'id' + string $operator = '=' + ?string $main = null +end note + +note right of GetHelper::vars + Get array of variables + + since: 3.0.9 + return: ?array + + arguments: + ?string $table = null + mixed $where = null + string $whereString = 'user' + string $what = 'id' + string $operator = 'IN' + ?string $main = null + bool $unique = true +end note + +note right of GetHelper::allBetween + 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 GetHelper::between + get a string between two other strings + + since: 3.0.9 + return: string + + arguments: + string $content + string $start + string $end + string $default = '' +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.php b/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.php index b9a864e..1f89e7b 100644 --- a/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.php +++ b/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.php @@ -9,4 +9,245 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Factory; +use VDM\Joomla\Utilities\Component\Helper; + + +/** + * Some easy get... + * + * @since 3.0.9 + */ +abstract class GetHelper +{ + /** + * Get a Variable + * + * @param string|null $table The table from which to get the variable + * @param mixed $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 mixed string/int/float + * @since 3.0.9 + */ + public static function var(?string $table = null, $where = null, + string $whereString = 'user', string $what = 'id', + string $operator = '=', ?string $main = null) + { + if(empty($where)) + { + $where = Factory::getUser()->id; + } + + if(empty($main)) + { + $main = Helper::getCode(); + } + + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + + if (empty($table)) + { + $query->from($db->quoteName('#__' . $main)); + } + else + { + $query->from($db->quoteName('#__' . $main . '_' . $table)); + } + + if (is_numeric($where)) + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' ' . (int) $where); + } + elseif (is_string($where)) + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' ' . $db->quote((string)$where)); + } + else + { + return false; + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadResult(); + } + + return false; + } + + /** + * Get array of variables + * + * @param string|null $table The table from which to get the variables + * @param mixed $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|null + * @since 3.0.9 + */ + public static function vars(?string $table = null, $where = null, + string $whereString = 'user', string $what = 'id', string $operator = 'IN', + ?string $main = null, bool $unique = true): ?array + { + if(empty($where)) + { + $where = Factory::getUser()->id; + } + + if($main === null) + { + $main = Helper::getCode(); + } + + if (!ArrayHelper::check($where) && $where > 0) + { + $where = [$where]; + } + + if (ArrayHelper::check($where)) + { + // prep main <-- why? well if $main='' is empty then $table can be categories or users + if (StringHelper::check($main)) + { + $main = '_' . ltrim($main, '_'); + } + + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + + if (empty($table)) + { + $query->from($db->quoteName('#__' . $main)); + } + else + { + $query->from($db->quoteName('#_' . $main . '_' . $table)); + } + + // add strings to array search + if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) + { + $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","', $where) . '")'); + } + else + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',', $where) . ')'); + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + if ($unique) + { + return array_unique($db->loadColumn()); + } + return $db->loadColumn(); + } + } + + return null; + } + + /** + * 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|null On success + * @since 3.0.9 + */ + public static function allBetween(string $content, string $start, string $end): ?array + { + // reset bucket + $bucket = []; + for ($i = 0; ; $i++) + { + // search for string + $found = self::between($content, $start, $end); + + if (StringHelper::check($found)) + { + // add to bucket + $bucket[] = $found; + + // build removal string + $remove = $start . $found . $end; + + // remove from content + $content = str_replace($remove, '', $content); + } + else + { + break; + } + + // safety catch + if ($i == 500) + { + break; + } + } + + // only return unique array of values + if (ArrayHelper::check($bucket)) + { + return array_unique($bucket); + } + + return null; + } + + /** + * 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 + */ + public static function between(string $content, string $start, string $end, string $default = ''): string + { + $array = explode($start, $content); + if (isset($array[1]) && strpos($array[1], $end) !== false) + { + $array = explode($end, $array[1]); + + // return string found between + return $array[0]; + } + + return $default; + } + +} + diff --git a/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.power b/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.power index 69309b0..dba9769 100644 --- a/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.power +++ b/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.power @@ -1 +1,225 @@ -###CODEPOWER### \ No newline at end of file + /** + * Get a Variable + * + * @param string|null $table The table from which to get the variable + * @param mixed $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 mixed string/int/float + * @since 3.0.9 + */ + public static function var(?string $table = null, $where = null, + string $whereString = 'user', string $what = 'id', + string $operator = '=', ?string $main = null) + { + if(empty($where)) + { + $where = Factory::getUser()->id; + } + + if(empty($main)) + { + $main = Helper::getCode(); + } + + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + + if (empty($table)) + { + $query->from($db->quoteName('#__' . $main)); + } + else + { + $query->from($db->quoteName('#__' . $main . '_' . $table)); + } + + if (is_numeric($where)) + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' ' . (int) $where); + } + elseif (is_string($where)) + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' ' . $db->quote((string)$where)); + } + else + { + return false; + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadResult(); + } + + return false; + } + + /** + * Get array of variables + * + * @param string|null $table The table from which to get the variables + * @param mixed $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|null + * @since 3.0.9 + */ + public static function vars(?string $table = null, $where = null, + string $whereString = 'user', string $what = 'id', string $operator = 'IN', + ?string $main = null, bool $unique = true): ?array + { + if(empty($where)) + { + $where = Factory::getUser()->id; + } + + if($main === null) + { + $main = Helper::getCode(); + } + + if (!ArrayHelper::check($where) && $where > 0) + { + $where = [$where]; + } + + if (ArrayHelper::check($where)) + { + // prep main <-- why? well if $main='' is empty then $table can be categories or users + if (StringHelper::check($main)) + { + $main = '_' . ltrim($main, '_'); + } + + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + + if (empty($table)) + { + $query->from($db->quoteName('#__' . $main)); + } + else + { + $query->from($db->quoteName('#_' . $main . '_' . $table)); + } + + // add strings to array search + if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) + { + $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","', $where) . '")'); + } + else + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',', $where) . ')'); + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + if ($unique) + { + return array_unique($db->loadColumn()); + } + return $db->loadColumn(); + } + } + + return null; + } + + /** + * 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|null On success + * @since 3.0.9 + */ + public static function allBetween(string $content, string $start, string $end): ?array + { + // reset bucket + $bucket = []; + for ($i = 0; ; $i++) + { + // search for string + $found = self::between($content, $start, $end); + + if (StringHelper::check($found)) + { + // add to bucket + $bucket[] = $found; + + // build removal string + $remove = $start . $found . $end; + + // remove from content + $content = str_replace($remove, '', $content); + } + else + { + break; + } + + // safety catch + if ($i == 500) + { + break; + } + } + + // only return unique array of values + if (ArrayHelper::check($bucket)) + { + return array_unique($bucket); + } + + return null; + } + + /** + * 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 + */ + public static function between(string $content, string $start, string $end, string $default = ''): string + { + $array = explode($start, $content); + if (isset($array[1]) && strpos($array[1], $end) !== false) + { + $array = explode($end, $array[1]); + + // return string found between + return $array[0]; + } + + return $default; + } diff --git a/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/settings.json b/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/settings.json index 6b3b222..0c84f92 100644 --- a/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/settings.json +++ b/src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/settings.json @@ -1 +1,30 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "0", + "guid": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc", + "implements": null, + "load_selection": { + "load_selection0": { + "load": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a" + }, + "load_selection1": { + "load": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef" + } + }, + "name": "GetHelper", + "power_version": "1.0.0", + "system_name": "Utilities GetHelper", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "640b5352-fb09-425f-a26e-cd44eda03f15", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Utilities.GetHelper", + "description": "Some easy get...\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 \r\n * @git 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\\CMS\\Factory;", + "composer": "" +} \ No newline at end of file diff --git a/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/README.md b/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/README.md index 433b69e..a65522c 100644 --- a/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/README.md +++ b/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/README.md @@ -1 +1,122 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class BaseTable (Details) +> namespace: **VDM\Joomla\Abstraction** +```uml +@startuml +abstract BaseTable #Orange { + # array $tables + + get(string $table, ?string $field = null, ...) : mixed + + title(string $table) : ?array + + titleName(string $table) : string + + tables() : array + + exist(string $table, ?string $field = null) : bool + + fields(string $table, bool $default = false) : ?array + # addDefault(array $fields) : array + # isDefault(string $field) : bool + # getDefault(string $field) : ?array + # getDefaultKey(string $field, string $key) : ?string +} + +note right of BaseTable::get + Get any value from a item/field/column of an area/view/table +Example: $this->get('table_name', 'field_name', 'value_key'); +Get an item/field/column of an area/view/table +Example: $this->get('table_name', 'field_name'); +Get all items/fields/columns of an area/view/table +Example: $this->get('table_name'); +Get all areas/views/tables with all their item/field/column details +Example: $this->get('All'); + + since: 3.2.0 + return: mixed + + arguments: + string $table + ?string $field = null + ?string $key = null +end note + +note left of BaseTable::title + Get title field from an area/view/table + + since: 3.2.0 + return: ?array +end note + +note right of BaseTable::titleName + Get title field name + + since: 3.2.0 + return: string +end note + +note left of BaseTable::tables + Get all tables + + since: 3.2.0 + return: array +end note + +note right of BaseTable::exist + Check if a table (and field) exist + + since: 3.2.0 + return: bool +end note + +note left of BaseTable::fields + Get all fields of an area/view/table + + since: 3.2.0 + return: ?array +end note + +note right of BaseTable::addDefault + Add the default fields + + since: 3.2.0 + return: array +end note + +note left of BaseTable::isDefault + Check if the field is a default field + + since: 3.2.0 + return: bool +end note + +note right of BaseTable::getDefault + Get a default field + + since: 3.2.0 + return: ?array +end note + +note left of BaseTable::getDefaultKey + Get a default field property + + since: 3.2.0 + return: ?string +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.php b/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.php index 26c1a50..468645b 100644 --- a/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.php +++ b/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.php @@ -9,4 +9,356 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction; + + +use VDM\Joomla\Interfaces\Tableinterface; + + +/** + * Base Table + * + * @since 3.2.0 + */ +abstract class BaseTable implements Tableinterface +{ + /** + * All areas/views/tables with their field details + * + * @var array + * @since 3.2.0 + **/ + protected array $tables; + + /** + * All default fields + * + * @var array + * @since 3.2.0 + **/ + protected array $defaults = [ + 'id' => [ + 'order' => -1, + 'name' => 'id', + 'label' => 'ID', + 'type' => 'text', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'ordering' => [ + 'name' => 'ordering', + 'label' => 'Ordering', + 'type' => 'number', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'published' => [ + 'name' => 'published', + 'label' => 'Status', + 'type' => 'list', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'modified_by' => [ + 'name' => 'modified_by', + 'label' => 'Modified by', + 'type' => 'user', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'modified' => [ + 'name' => 'modified', + 'label' => 'Modified', + 'type' => 'calendar', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'created_by' => [ + 'name' => 'created_by', + 'label' => 'Created by', + 'type' => 'user', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'created' => [ + 'name' => 'created', + 'label' => 'Created', + 'type' => 'calendar', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'hits' => [ + 'name' => 'hits', + 'label' => 'Hits', + 'type' => 'number', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'version' => [ + 'name' => 'version', + 'label' => 'Version', + 'type' => 'text', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ] + ]; + + /** + * Get any value from a item/field/column of an area/view/table + * Example: $this->get('table_name', 'field_name', 'value_key'); + * Get an item/field/column of an area/view/table + * Example: $this->get('table_name', 'field_name'); + * Get all items/fields/columns of an area/view/table + * Example: $this->get('table_name'); + * Get all areas/views/tables with all their item/field/column details + * Example: $this->get('All'); + * + * @param string $table The table + * @param string|null $field The field + * @param string|null $key The value key + * + * @return mixed + * @since 3.2.0 + */ + public function get(string $table, ?string $field = null, ?string $key = null) + { + // return the item/field/column of an area/view/table + if (is_string($field) && is_string($key)) + { + // return the value of a item/field/column of an area/view/table + if (isset($this->tables[$table][$field][$key])) + { + return $this->tables[$table][$field][$key]; + } + + return $this->getDefaultKey($field, $key); + } + // return the item/field/column of an area/view/table + elseif (is_string($field)) + { + if (isset($this->tables[$table][$field])) + { + return $this->tables[$table][$field]; + } + + return $this->getDefault($field); + } + // return an area/view/table + elseif ($table !== 'All') + { + if (isset($this->tables[$table])) + { + return $this->tables[$table]; + } + return null; + } + + // return all + return $this->tables; + } + + /** + * Get title field from an area/view/table + * + * @param string $table The area + * + * @return ?array + * @since 3.2.0 + */ + public function title(string $table): ?array + { + // return the title item/field/column of an area/view/table + if (($table = $this->get($table)) !== null) + { + foreach ($table as $item) + { + if ($item['title']) + { + return $item; + } + } + } + + // none found + return null; + } + + /** + * Get title field name + * + * @param string $table The area + * + * @return string + * @since 3.2.0 + */ + public function titleName(string $table): string + { + // return the title name of an area/view/table + if (($field = $this->title($table)) !== null) + { + return $field['name']; + } + + // none found default to ID + return 'id'; + } + + /** + * Get all tables + * + * @return array + * @since 3.2.0 + */ + public function tables(): array + { + // return all areas/views/tables + return array_keys($this->tables); + } + + /** + * Check if a table (and field) exist + * + * @param string $table The area + * @param string|null $field The area + * + * @return bool + * @since 3.2.0 + */ + public function exist(string $table, ?string $field = null): bool + { + if (isset($this->tables[$table])) + { + // if we have a field + if (is_string($field)) + { + if (isset($this->tables[$table][$field])) + { + return true; + } + } + else + { + return true; + } + } + + return $this->isDefault($field); + } + + /** + * Get all fields of an area/view/table + * + * @param string $table The area + * @param bool $default Add the default fields + * + * @return array|null On success an array of fields + * @since 3.2.0 + */ + public function fields(string $table, bool $default = false): ?array + { + // return all fields of an area/view/table + if (($table = $this->get($table)) !== null) + { + if ($default) + { + return $this->addDefault(array_keys($table)); + } + else + { + return array_keys($table); + } + } + + // none found + return null; + } + + /** + * Add the default fields + * + * @param array $fields The table dynamic fields + * + * @return array Fields (with defaults added) + * @since 3.2.0 + */ + protected function addDefault(array $fields): array + { + // add default fields + foreach ($this->defaults as $default) + { + // used just for loading the fields + $order = $default['order'] ?? 1; + unset($default['order']); + + if ($order < 0) + { + array_unshift($fields, $default['name']); + } + else + { + $fields[] = $default['name']; + } + } + + return $fields; + } + + /** + * Check if the field is a default field + * + * @param string $field The field to check + * + * @return bool True if a default field + * @since 3.2.0 + */ + protected function isDefault(string $field): bool + { + return isset($this->defaults[$field]); + } + + /** + * Get a default field + * + * @param string $field The field to check + * + * @return array|null True if a default field + * @since 3.2.0 + */ + protected function getDefault(string $field): ?array + { + return $this->defaults[$field] ?? null; + } + + /** + * Get a default field property + * + * @param string $field The field to check + * @param string $key The field key/property to check + * + * @return string|null String value if a default field property exist + * @since 3.2.0 + */ + protected function getDefaultKey(string $field, string $key): ?string + { + return $this->defaults[$field][$key] ?? null; + } +} + diff --git a/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.power b/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.power index 69309b0..7de1cb4 100644 --- a/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.power +++ b/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.power @@ -1 +1,338 @@ -###CODEPOWER### \ No newline at end of file + /** + * All areas/views/tables with their field details + * + * @var array + * @since 3.2.0 + **/ + protected array $tables; + + /** + * All default fields + * + * @var array + * @since 3.2.0 + **/ + protected array $defaults = [ + 'id' => [ + 'order' => -1, + 'name' => 'id', + 'label' => 'ID', + 'type' => 'text', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'ordering' => [ + 'name' => 'ordering', + 'label' => 'Ordering', + 'type' => 'number', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'published' => [ + 'name' => 'published', + 'label' => 'Status', + 'type' => 'list', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'modified_by' => [ + 'name' => 'modified_by', + 'label' => 'Modified by', + 'type' => 'user', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'modified' => [ + 'name' => 'modified', + 'label' => 'Modified', + 'type' => 'calendar', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'created_by' => [ + 'name' => 'created_by', + 'label' => 'Created by', + 'type' => 'user', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'created' => [ + 'name' => 'created', + 'label' => 'Created', + 'type' => 'calendar', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'hits' => [ + 'name' => 'hits', + 'label' => 'Hits', + 'type' => 'number', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ], + 'version' => [ + 'name' => 'version', + 'label' => 'Version', + 'type' => 'text', + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL + ] + ]; + + /** + * Get any value from a item/field/column of an area/view/table + * Example: $this->get('table_name', 'field_name', 'value_key'); + * Get an item/field/column of an area/view/table + * Example: $this->get('table_name', 'field_name'); + * Get all items/fields/columns of an area/view/table + * Example: $this->get('table_name'); + * Get all areas/views/tables with all their item/field/column details + * Example: $this->get('All'); + * + * @param string $table The table + * @param string|null $field The field + * @param string|null $key The value key + * + * @return mixed + * @since 3.2.0 + */ + public function get(string $table, ?string $field = null, ?string $key = null) + { + // return the item/field/column of an area/view/table + if (is_string($field) && is_string($key)) + { + // return the value of a item/field/column of an area/view/table + if (isset($this->tables[$table][$field][$key])) + { + return $this->tables[$table][$field][$key]; + } + + return $this->getDefaultKey($field, $key); + } + // return the item/field/column of an area/view/table + elseif (is_string($field)) + { + if (isset($this->tables[$table][$field])) + { + return $this->tables[$table][$field]; + } + + return $this->getDefault($field); + } + // return an area/view/table + elseif ($table !== 'All') + { + if (isset($this->tables[$table])) + { + return $this->tables[$table]; + } + return null; + } + + // return all + return $this->tables; + } + + /** + * Get title field from an area/view/table + * + * @param string $table The area + * + * @return ?array + * @since 3.2.0 + */ + public function title(string $table): ?array + { + // return the title item/field/column of an area/view/table + if (($table = $this->get($table)) !== null) + { + foreach ($table as $item) + { + if ($item['title']) + { + return $item; + } + } + } + + // none found + return null; + } + + /** + * Get title field name + * + * @param string $table The area + * + * @return string + * @since 3.2.0 + */ + public function titleName(string $table): string + { + // return the title name of an area/view/table + if (($field = $this->title($table)) !== null) + { + return $field['name']; + } + + // none found default to ID + return 'id'; + } + + /** + * Get all tables + * + * @return array + * @since 3.2.0 + */ + public function tables(): array + { + // return all areas/views/tables + return array_keys($this->tables); + } + + /** + * Check if a table (and field) exist + * + * @param string $table The area + * @param string|null $field The area + * + * @return bool + * @since 3.2.0 + */ + public function exist(string $table, ?string $field = null): bool + { + if (isset($this->tables[$table])) + { + // if we have a field + if (is_string($field)) + { + if (isset($this->tables[$table][$field])) + { + return true; + } + } + else + { + return true; + } + } + + return $this->isDefault($field); + } + + /** + * Get all fields of an area/view/table + * + * @param string $table The area + * @param bool $default Add the default fields + * + * @return array|null On success an array of fields + * @since 3.2.0 + */ + public function fields(string $table, bool $default = false): ?array + { + // return all fields of an area/view/table + if (($table = $this->get($table)) !== null) + { + if ($default) + { + return $this->addDefault(array_keys($table)); + } + else + { + return array_keys($table); + } + } + + // none found + return null; + } + + /** + * Add the default fields + * + * @param array $fields The table dynamic fields + * + * @return array Fields (with defaults added) + * @since 3.2.0 + */ + protected function addDefault(array $fields): array + { + // add default fields + foreach ($this->defaults as $default) + { + // used just for loading the fields + $order = $default['order'] ?? 1; + unset($default['order']); + + if ($order < 0) + { + array_unshift($fields, $default['name']); + } + else + { + $fields[] = $default['name']; + } + } + + return $fields; + } + + /** + * Check if the field is a default field + * + * @param string $field The field to check + * + * @return bool True if a default field + * @since 3.2.0 + */ + protected function isDefault(string $field): bool + { + return isset($this->defaults[$field]); + } + + /** + * Get a default field + * + * @param string $field The field to check + * + * @return array|null True if a default field + * @since 3.2.0 + */ + protected function getDefault(string $field): ?array + { + return $this->defaults[$field] ?? null; + } + + /** + * Get a default field property + * + * @param string $field The field to check + * @param string $key The field key/property to check + * + * @return string|null String value if a default field property exist + * @since 3.2.0 + */ + protected function getDefaultKey(string $field, string $key): ?string + { + return $this->defaults[$field][$key] ?? null; + } \ No newline at end of file diff --git a/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/settings.json b/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/settings.json index 6b3b222..61b51ac 100644 --- a/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/settings.json +++ b/src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/settings.json @@ -1 +1,20 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "e0f6ddbe-2a35-4537-942c-faff2ebd04f6", + "implements": [ + "2da6d6c4-eb29-4d69-8bc2-36d96e916adf" + ], + "load_selection": null, + "name": "BaseTable", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.BaseTable", + "type": "abstract class", + "use_selection": null, + "namespace": "VDM\\Joomla\\Abstraction.BaseTable", + "description": "Base Table\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/README.md b/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/README.md index 433b69e..4405cb0 100644 --- a/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/README.md +++ b/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/README.md @@ -1 +1,37 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# trait IsString (Details) +> namespace: **VDM\Joomla\Abstraction\Registry\Traits** +```uml +@startuml +class IsString << (T,Orange) >> #Turquoise { + + isString(string $path) : bool +} + +note right of IsString::isString + Check if a registry path exists and is a string + + since: 3.2.0 + return: bool +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.php b/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.php index 26c1a50..e0b69ca 100644 --- a/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.php +++ b/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.php @@ -9,4 +9,40 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction\Registry\Traits; + + +/** + * Is String Values + * + * @since 3.2.0 + */ +trait IsString +{ + /** + * Check if a registry path exists and is a string + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return boolean + * @since 3.2.0 + */ + public function isString(string $path): bool + { + // Return default value if path is empty + if (empty($path)) { + return false; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_string($node) + && strlen((string) $node) > 0) + { + return true; + } + + return false; + } +} + diff --git a/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.power b/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.power index 69309b0..aea5260 100644 --- a/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.power +++ b/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.power @@ -1 +1,25 @@ -###CODEPOWER### \ No newline at end of file + /** + * Check if a registry path exists and is a string + * + * @param string $path Registry path (e.g. joomla.content.showauthor) + * + * @return boolean + * @since 3.2.0 + */ + public function isString(string $path): bool + { + // Return default value if path is empty + if (empty($path)) { + return false; + } + + // get the value + if (($node = $this->get($path)) !== null + && is_string($node) + && strlen((string) $node) > 0) + { + return true; + } + + return false; + } \ No newline at end of file diff --git a/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/settings.json b/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/settings.json index 6b3b222..0c47589 100644 --- a/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/settings.json +++ b/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/settings.json @@ -1 +1,18 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "ff7d0111-8f79-42aa-ac14-b53ba2c49369", + "implements": null, + "load_selection": null, + "name": "IsString", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.Registry.Traits.IsString", + "type": "trait", + "use_selection": null, + "namespace": "VDM\\Joomla\\Abstraction.Registry.Traits.IsString", + "description": "Is String Values\r\n\r\n@since 3.2.0", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/README.md b/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/README.md index 433b69e..f288632 100644 --- a/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/README.md +++ b/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/README.md @@ -1 +1,67 @@ -###POWERREADME### \ No newline at end of file +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class BaseConfig (Details) +> namespace: **VDM\Joomla\Abstraction** +> extends: **JoomlaRegistry** +```uml +@startuml +abstract BaseConfig #Orange { + + __construct() + + __set(string $key, mixed $value) + + __get(string $key) + + get(string $path, mixed $default = null) : mixed + + appendArray(string $path, mixed $value) : mixed +} + +note right of BaseConfig::__construct + Constructor + + since: 3.2.0 +end note + +note right of BaseConfig::__set + setting any config value + + since: 3.2.0 +end note + +note right of BaseConfig::__get + getting any valid value + + since: 3.2.0 +end note + +note right of BaseConfig::get + Get a config value. + + since: 3.2.0 + return: mixed +end note + +note right of BaseConfig::appendArray + Append value to a path in registry of an array + + since: 3.2.0 + return: mixed +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.php b/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.php index 26c1a50..c4debc2 100644 --- a/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.php +++ b/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.php @@ -9,4 +9,114 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -###POWERCODE### +namespace VDM\Joomla\Abstraction; + + +use Joomla\Registry\Registry as JoomlaRegistry; +use VDM\Joomla\Utilities\String\ClassfunctionHelper; + + +/** + * Config + * + * @since 3.2.0 + */ +abstract class BaseConfig extends JoomlaRegistry +{ + /** + * Constructor + * + * @since 3.2.0 + */ + public function __construct() + { + // Instantiate the internal data object. + $this->data = new \stdClass(); + } + + /** + * setting any config value + * + * @param string $key The value's key/path name + * @param mixed $value Optional default value, returned if the internal value is null. + * + * @since 3.2.0 + */ + public function __set($key, $value) + { + $this->set($key, $value); + } + + /** + * getting any valid value + * + * @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($key) + { + // check if it has been set + if (($value = $this->get($key, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_') + { + return $value; + } + + throw new \InvalidArgumentException(sprintf('Argument %s could not be found as function or path.', $key)); + } + + /** + * Get a config value. + * + * @param string $path Registry path (e.g. joomla_content_showauthor) + * @param mixed $default Optional default value, returned if the internal value is null. + * + * @return mixed Value of entry or null + * + * @since 3.2.0 + */ + public function get($path, $default = null) + { + // function name with no underscores + $method = 'get' . ucfirst((string) ClassfunctionHelper::safe(str_replace('_', '', $path))); + + // check if it has been set + if (($value = parent::get($path, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_') + { + return $value; + } + elseif (method_exists($this, $method)) + { + $value = $this->{$method}($default); + + $this->set($path, $value); + + return $value; + } + + return $default; + } + + /** + * Append value to a path in registry of an array + * + * @param string $path Parent registry Path (e.g. joomla.content.showauthor) + * @param mixed $value Value of entry + * + * @return mixed The value of the that has been set. + * + * @since 3.2.0 + */ + public function appendArray(string $path, $value) + { + // check if it does not exist + if (!$this->exists($path)) + { + $this->set($path, []); + } + + return $this->append($path, $value); + } +} + diff --git a/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.power b/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.power index 69309b0..9afb467 100644 --- a/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.power +++ b/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.power @@ -1 +1,95 @@ -###CODEPOWER### \ No newline at end of file + /** + * Constructor + * + * @since 3.2.0 + */ + public function __construct() + { + // Instantiate the internal data object. + $this->data = new \stdClass(); + } + + /** + * setting any config value + * + * @param string $key The value's key/path name + * @param mixed $value Optional default value, returned if the internal value is null. + * + * @since 3.2.0 + */ + public function __set($key, $value) + { + $this->set($key, $value); + } + + /** + * getting any valid value + * + * @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($key) + { + // check if it has been set + if (($value = $this->get($key, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_') + { + return $value; + } + + throw new \InvalidArgumentException(sprintf('Argument %s could not be found as function or path.', $key)); + } + + /** + * Get a config value. + * + * @param string $path Registry path (e.g. joomla_content_showauthor) + * @param mixed $default Optional default value, returned if the internal value is null. + * + * @return mixed Value of entry or null + * + * @since 3.2.0 + */ + public function get($path, $default = null) + { + // function name with no underscores + $method = 'get' . ucfirst((string) ClassfunctionHelper::safe(str_replace('_', '', $path))); + + // check if it has been set + if (($value = parent::get($path, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_') + { + return $value; + } + elseif (method_exists($this, $method)) + { + $value = $this->{$method}($default); + + $this->set($path, $value); + + return $value; + } + + return $default; + } + + /** + * Append value to a path in registry of an array + * + * @param string $path Parent registry Path (e.g. joomla.content.showauthor) + * @param mixed $value Value of entry + * + * @return mixed The value of the that has been set. + * + * @since 3.2.0 + */ + public function appendArray(string $path, $value) + { + // check if it does not exist + if (!$this->exists($path)) + { + $this->set($path, []); + } + + return $this->append($path, $value); + } \ No newline at end of file diff --git a/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/settings.json b/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/settings.json index 6b3b222..2457d35 100644 --- a/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/settings.json +++ b/src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/settings.json @@ -1 +1,24 @@ -###POWERLINKER### \ No newline at end of file +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "-1", + "guid": "ffbd4e1f-a342-4080-ab7d-1de3741bf319", + "implements": null, + "load_selection": null, + "name": "BaseConfig", + "power_version": "1.0.0", + "system_name": "VDM.Abstraction.BaseConfig", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "30c5b4c2-f75f-4d15-869a-f8bfedd87358", + "as": "default" + } + }, + "namespace": "VDM\\Joomla\\Abstraction.BaseConfig", + "description": "Config\r\n\r\n@since 3.2.0", + "extends_custom": "JoomlaRegistry", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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\\Registry\\Registry as JoomlaRegistry;", + "composer": "" +} \ No newline at end of file diff --git a/super-powers.json b/super-powers.json index 18f683b..e22363e 100644 --- a/super-powers.json +++ b/super-powers.json @@ -1 +1,486 @@ -###POWERINDEX### \ No newline at end of file +{ + "06f8eada-d59b-441c-b287-0aea1793da5a": { + "name": "Load", + "type": "final class", + "namespace": "VDM\\Joomla\\Database", + "code": "src\/06f8eada-d59b-441c-b287-0aea1793da5a\/code.php", + "power": "src\/06f8eada-d59b-441c-b287-0aea1793da5a\/code.power", + "settings": "src\/06f8eada-d59b-441c-b287-0aea1793da5a\/settings.json", + "path": "src\/06f8eada-d59b-441c-b287-0aea1793da5a", + "spk": "Super__06f8eada_d59b_441c_b287_0aea1793da5a__Power", + "guid": "06f8eada-d59b-441c-b287-0aea1793da5a" + }, + "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a": { + "name": "ArrayHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities", + "code": "src\/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a\/code.php", + "power": "src\/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a\/code.power", + "settings": "src\/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a\/settings.json", + "path": "src\/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a", + "spk": "Super__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a__Power", + "guid": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a" + }, + "11572d9b-e3d5-4b29-904c-9618d8f2bfd8": { + "name": "Count", + "type": "trait", + "namespace": "VDM\\Joomla\\Abstraction\\Registry\\Traits", + "code": "src\/11572d9b-e3d5-4b29-904c-9618d8f2bfd8\/code.php", + "power": "src\/11572d9b-e3d5-4b29-904c-9618d8f2bfd8\/code.power", + "settings": "src\/11572d9b-e3d5-4b29-904c-9618d8f2bfd8\/settings.json", + "path": "src\/11572d9b-e3d5-4b29-904c-9618d8f2bfd8", + "spk": "Super__11572d9b_e3d5_4b29_904c_9618d8f2bfd8__Power", + "guid": "11572d9b-e3d5-4b29-904c-9618d8f2bfd8" + }, + "1198aecf-84c6-45d2-aea8-d531aa4afdfa": { + "name": "FormHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities", + "code": "src\/1198aecf-84c6-45d2-aea8-d531aa4afdfa\/code.php", + "power": "src\/1198aecf-84c6-45d2-aea8-d531aa4afdfa\/code.power", + "settings": "src\/1198aecf-84c6-45d2-aea8-d531aa4afdfa\/settings.json", + "path": "src\/1198aecf-84c6-45d2-aea8-d531aa4afdfa", + "spk": "Super__1198aecf_84c6_45d2_aea8_d531aa4afdfa__Power", + "guid": "1198aecf-84c6-45d2-aea8-d531aa4afdfa" + }, + "152c8793-8b75-4715-996a-257b9f65451c": { + "name": "MathHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities", + "code": "src\/152c8793-8b75-4715-996a-257b9f65451c\/code.php", + "power": "src\/152c8793-8b75-4715-996a-257b9f65451c\/code.power", + "settings": "src\/152c8793-8b75-4715-996a-257b9f65451c\/settings.json", + "path": "src\/152c8793-8b75-4715-996a-257b9f65451c", + "spk": "Super__152c8793_8b75_4715_996a_257b9f65451c__Power", + "guid": "152c8793-8b75-4715-996a-257b9f65451c" + }, + "1f28cb53-60d9-4db1-b517-3c7dc6b429ef": { + "name": "StringHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities", + "code": "src\/1f28cb53-60d9-4db1-b517-3c7dc6b429ef\/code.php", + "power": "src\/1f28cb53-60d9-4db1-b517-3c7dc6b429ef\/code.power", + "settings": "src\/1f28cb53-60d9-4db1-b517-3c7dc6b429ef\/settings.json", + "path": "src\/1f28cb53-60d9-4db1-b517-3c7dc6b429ef", + "spk": "Super__1f28cb53_60d9_4db1_b517_3c7dc6b429ef__Power", + "guid": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef" + }, + "215b35ac-1b26-4838-bbcf-d1fdbbd9353f": { + "name": "InArray", + "type": "trait", + "namespace": "VDM\\Joomla\\Abstraction\\Registry\\Traits", + "code": "src\/215b35ac-1b26-4838-bbcf-d1fdbbd9353f\/code.php", + "power": "src\/215b35ac-1b26-4838-bbcf-d1fdbbd9353f\/code.power", + "settings": "src\/215b35ac-1b26-4838-bbcf-d1fdbbd9353f\/settings.json", + "path": "src\/215b35ac-1b26-4838-bbcf-d1fdbbd9353f", + "spk": "Super__215b35ac_1b26_4838_bbcf_d1fdbbd9353f__Power", + "guid": "215b35ac-1b26-4838-bbcf-d1fdbbd9353f" + }, + "2ad31f74-f579-499d-b98b-c4f54fd615dd": { + "name": "LoadInterface", + "type": "interface", + "namespace": "VDM\\Joomla\\Interfaces", + "code": "src\/2ad31f74-f579-499d-b98b-c4f54fd615dd\/code.php", + "power": "src\/2ad31f74-f579-499d-b98b-c4f54fd615dd\/code.power", + "settings": "src\/2ad31f74-f579-499d-b98b-c4f54fd615dd\/settings.json", + "path": "src\/2ad31f74-f579-499d-b98b-c4f54fd615dd", + "spk": "Super__2ad31f74_f579_499d_b98b_c4f54fd615dd__Power", + "guid": "2ad31f74-f579-499d-b98b-c4f54fd615dd" + }, + "2da6d6c4-eb29-4d69-8bc2-36d96e916adf": { + "name": "Tableinterface", + "type": "interface", + "namespace": "VDM\\Joomla\\Interfaces", + "code": "src\/2da6d6c4-eb29-4d69-8bc2-36d96e916adf\/code.php", + "power": "src\/2da6d6c4-eb29-4d69-8bc2-36d96e916adf\/code.power", + "settings": "src\/2da6d6c4-eb29-4d69-8bc2-36d96e916adf\/settings.json", + "path": "src\/2da6d6c4-eb29-4d69-8bc2-36d96e916adf", + "spk": "Super__2da6d6c4_eb29_4d69_8bc2_36d96e916adf__Power", + "guid": "2da6d6c4-eb29-4d69-8bc2-36d96e916adf" + }, + "30c5b4c2-f75f-4d15-869a-f8bfedd87358": { + "name": "ClassfunctionHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities\\String", + "code": "src\/30c5b4c2-f75f-4d15-869a-f8bfedd87358\/code.php", + "power": "src\/30c5b4c2-f75f-4d15-869a-f8bfedd87358\/code.power", + "settings": "src\/30c5b4c2-f75f-4d15-869a-f8bfedd87358\/settings.json", + "path": "src\/30c5b4c2-f75f-4d15-869a-f8bfedd87358", + "spk": "Super__30c5b4c2_f75f_4d15_869a_f8bfedd87358__Power", + "guid": "30c5b4c2-f75f-4d15-869a-f8bfedd87358" + }, + "3cf76fbf-fd95-4a33-878e-7aff6d36b7f6": { + "name": "PluginHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities\\String", + "code": "src\/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6\/code.php", + "power": "src\/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6\/code.power", + "settings": "src\/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6\/settings.json", + "path": "src\/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6", + "spk": "Super__3cf76fbf_fd95_4a33_878e_7aff6d36b7f6__Power", + "guid": "3cf76fbf-fd95-4a33-878e-7aff6d36b7f6" + }, + "43134867-5cb8-4280-9be8-309fd2fd135f": { + "name": "ActiveRegistry", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Abstraction", + "code": "src\/43134867-5cb8-4280-9be8-309fd2fd135f\/code.php", + "power": "src\/43134867-5cb8-4280-9be8-309fd2fd135f\/code.power", + "settings": "src\/43134867-5cb8-4280-9be8-309fd2fd135f\/settings.json", + "path": "src\/43134867-5cb8-4280-9be8-309fd2fd135f", + "spk": "Super__43134867_5cb8_4280_9be8_309fd2fd135f__Power", + "guid": "43134867-5cb8-4280-9be8-309fd2fd135f" + }, + "4815e1c7-a433-443d-a112-d1e03d7df84b": { + "name": "Database", + "type": "class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Service", + "code": "src\/4815e1c7-a433-443d-a112-d1e03d7df84b\/code.php", + "power": "src\/4815e1c7-a433-443d-a112-d1e03d7df84b\/code.power", + "settings": "src\/4815e1c7-a433-443d-a112-d1e03d7df84b\/settings.json", + "path": "src\/4815e1c7-a433-443d-a112-d1e03d7df84b", + "spk": "Super__4815e1c7_a433_443d_a112_d1e03d7df84b__Power", + "guid": "4815e1c7-a433-443d-a112-d1e03d7df84b" + }, + "4b225c51-d293-48e4-b3f6-5136cf5c3f18": { + "name": "JsonHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities", + "code": "src\/4b225c51-d293-48e4-b3f6-5136cf5c3f18\/code.php", + "power": "src\/4b225c51-d293-48e4-b3f6-5136cf5c3f18\/code.power", + "settings": "src\/4b225c51-d293-48e4-b3f6-5136cf5c3f18\/settings.json", + "path": "src\/4b225c51-d293-48e4-b3f6-5136cf5c3f18", + "spk": "Super__4b225c51_d293_48e4_b3f6_5136cf5c3f18__Power", + "guid": "4b225c51-d293-48e4-b3f6-5136cf5c3f18" + }, + "524eb8f6-38d4-47dc-92ad-98b94e099ac0": { + "name": "Insert", + "type": "final class", + "namespace": "VDM\\Joomla\\Database", + "code": "src\/524eb8f6-38d4-47dc-92ad-98b94e099ac0\/code.php", + "power": "src\/524eb8f6-38d4-47dc-92ad-98b94e099ac0\/code.power", + "settings": "src\/524eb8f6-38d4-47dc-92ad-98b94e099ac0\/settings.json", + "path": "src\/524eb8f6-38d4-47dc-92ad-98b94e099ac0", + "spk": "Super__524eb8f6_38d4_47dc_92ad_98b94e099ac0__Power", + "guid": "524eb8f6-38d4-47dc-92ad-98b94e099ac0" + }, + "52a1d14f-304a-431c-8fa4-411179942db5": { + "name": "VarExport", + "type": "trait", + "namespace": "VDM\\Joomla\\Abstraction\\Registry\\Traits", + "code": "src\/52a1d14f-304a-431c-8fa4-411179942db5\/code.php", + "power": "src\/52a1d14f-304a-431c-8fa4-411179942db5\/code.power", + "settings": "src\/52a1d14f-304a-431c-8fa4-411179942db5\/settings.json", + "path": "src\/52a1d14f-304a-431c-8fa4-411179942db5", + "spk": "Super__52a1d14f_304a_431c_8fa4_411179942db5__Power", + "guid": "52a1d14f-304a-431c-8fa4-411179942db5" + }, + "584747d1-3a86-453d-b7a3-a2219de8d777": { + "name": "Model", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Abstraction", + "code": "src\/584747d1-3a86-453d-b7a3-a2219de8d777\/code.php", + "power": "src\/584747d1-3a86-453d-b7a3-a2219de8d777\/code.power", + "settings": "src\/584747d1-3a86-453d-b7a3-a2219de8d777\/settings.json", + "path": "src\/584747d1-3a86-453d-b7a3-a2219de8d777", + "spk": "Super__584747d1_3a86_453d_b7a3_a2219de8d777__Power", + "guid": "584747d1-3a86-453d-b7a3-a2219de8d777" + }, + "59b1a2ea-d77e-4040-ac8c-e65cd8743e9b": { + "name": "GetString", + "type": "trait", + "namespace": "VDM\\Joomla\\Abstraction\\Registry\\Traits", + "code": "src\/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b\/code.php", + "power": "src\/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b\/code.power", + "settings": "src\/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b\/settings.json", + "path": "src\/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b", + "spk": "Super__59b1a2ea_d77e_4040_ac8c_e65cd8743e9b__Power", + "guid": "59b1a2ea-d77e-4040-ac8c-e65cd8743e9b" + }, + "640b5352-fb09-425f-a26e-cd44eda03f15": { + "name": "Helper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities\\Component", + "code": "src\/640b5352-fb09-425f-a26e-cd44eda03f15\/code.php", + "power": "src\/640b5352-fb09-425f-a26e-cd44eda03f15\/code.power", + "settings": "src\/640b5352-fb09-425f-a26e-cd44eda03f15\/settings.json", + "path": "src\/640b5352-fb09-425f-a26e-cd44eda03f15", + "spk": "Super__640b5352_fb09_425f_a26e_cd44eda03f15__Power", + "guid": "640b5352-fb09-425f-a26e-cd44eda03f15" + }, + "64a6ff6c-069c-4a11-a76b-db5e36c27690": { + "name": "Base64Helper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities", + "code": "src\/64a6ff6c-069c-4a11-a76b-db5e36c27690\/code.php", + "power": "src\/64a6ff6c-069c-4a11-a76b-db5e36c27690\/code.power", + "settings": "src\/64a6ff6c-069c-4a11-a76b-db5e36c27690\/settings.json", + "path": "src\/64a6ff6c-069c-4a11-a76b-db5e36c27690", + "spk": "Super__64a6ff6c_069c_4a11_a76b_db5e36c27690__Power", + "guid": "64a6ff6c-069c-4a11-a76b-db5e36c27690" + }, + "64e291c2-11f1-423d-a44d-837cc12cc017": { + "name": "Registryinterface", + "type": "interface", + "namespace": "VDM\\Joomla\\Interfaces", + "code": "src\/64e291c2-11f1-423d-a44d-837cc12cc017\/code.php", + "power": "src\/64e291c2-11f1-423d-a44d-837cc12cc017\/code.power", + "settings": "src\/64e291c2-11f1-423d-a44d-837cc12cc017\/settings.json", + "path": "src\/64e291c2-11f1-423d-a44d-837cc12cc017", + "spk": "Super__64e291c2_11f1_423d_a44d_837cc12cc017__Power", + "guid": "64e291c2-11f1-423d-a44d-837cc12cc017" + }, + "6cbef8f8-4813-48e3-b05a-65e1aea95171": { + "name": "Database", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Abstraction", + "code": "src\/6cbef8f8-4813-48e3-b05a-65e1aea95171\/code.php", + "power": "src\/6cbef8f8-4813-48e3-b05a-65e1aea95171\/code.power", + "settings": "src\/6cbef8f8-4813-48e3-b05a-65e1aea95171\/settings.json", + "path": "src\/6cbef8f8-4813-48e3-b05a-65e1aea95171", + "spk": "Super__6cbef8f8_4813_48e3_b05a_65e1aea95171__Power", + "guid": "6cbef8f8-4813-48e3-b05a-65e1aea95171" + }, + "7179fde6-1e51-4b51-8545-7ca18f74a0f4": { + "name": "UpdateInterface", + "type": "interface", + "namespace": "VDM\\Joomla\\Interfaces", + "code": "src\/7179fde6-1e51-4b51-8545-7ca18f74a0f4\/code.php", + "power": "src\/7179fde6-1e51-4b51-8545-7ca18f74a0f4\/code.power", + "settings": "src\/7179fde6-1e51-4b51-8545-7ca18f74a0f4\/settings.json", + "path": "src\/7179fde6-1e51-4b51-8545-7ca18f74a0f4", + "spk": "Super__7179fde6_1e51_4b51_8545_7ca18f74a0f4__Power", + "guid": "7179fde6-1e51-4b51-8545-7ca18f74a0f4" + }, + "7d494d91-ab60-43cd-aecf-d50e07f7f30e": { + "name": "ToString", + "type": "trait", + "namespace": "VDM\\Joomla\\Abstraction\\Registry\\Traits", + "code": "src\/7d494d91-ab60-43cd-aecf-d50e07f7f30e\/code.php", + "power": "src\/7d494d91-ab60-43cd-aecf-d50e07f7f30e\/code.power", + "settings": "src\/7d494d91-ab60-43cd-aecf-d50e07f7f30e\/settings.json", + "path": "src\/7d494d91-ab60-43cd-aecf-d50e07f7f30e", + "spk": "Super__7d494d91_ab60_43cd_aecf_d50e07f7f30e__Power", + "guid": "7d494d91-ab60-43cd-aecf-d50e07f7f30e" + }, + "7e822c03-1b20-41d1-9427-f5b8d5836af7": { + "name": "Registry", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Abstraction", + "code": "src\/7e822c03-1b20-41d1-9427-f5b8d5836af7\/code.php", + "power": "src\/7e822c03-1b20-41d1-9427-f5b8d5836af7\/code.power", + "settings": "src\/7e822c03-1b20-41d1-9427-f5b8d5836af7\/settings.json", + "path": "src\/7e822c03-1b20-41d1-9427-f5b8d5836af7", + "spk": "Super__7e822c03_1b20_41d1_9427_f5b8d5836af7__Power", + "guid": "7e822c03-1b20-41d1-9427-f5b8d5836af7" + }, + "8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff": { + "name": "ModelInterface", + "type": "interface", + "namespace": "VDM\\Joomla\\Interfaces", + "code": "src\/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff\/code.php", + "power": "src\/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff\/code.power", + "settings": "src\/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff\/settings.json", + "path": "src\/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff", + "spk": "Super__8aef58c1_3f70_4bd4_b9e4_3f29fcd41cff__Power", + "guid": "8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff" + }, + "91004529-94a9-4590-b842-e7c6b624ecf5": { + "name": "ObjectHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities", + "code": "src\/91004529-94a9-4590-b842-e7c6b624ecf5\/code.php", + "power": "src\/91004529-94a9-4590-b842-e7c6b624ecf5\/code.power", + "settings": "src\/91004529-94a9-4590-b842-e7c6b624ecf5\/settings.json", + "path": "src\/91004529-94a9-4590-b842-e7c6b624ecf5", + "spk": "Super__91004529_94a9_4590_b842_e7c6b624ecf5__Power", + "guid": "91004529-94a9-4590-b842-e7c6b624ecf5" + }, + "9c513baf-b279-43fd-ae29-a585c8cbc4f0": { + "name": "GuidHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities", + "code": "src\/9c513baf-b279-43fd-ae29-a585c8cbc4f0\/code.php", + "power": "src\/9c513baf-b279-43fd-ae29-a585c8cbc4f0\/code.power", + "settings": "src\/9c513baf-b279-43fd-ae29-a585c8cbc4f0\/settings.json", + "path": "src\/9c513baf-b279-43fd-ae29-a585c8cbc4f0", + "spk": "Super__9c513baf_b279_43fd_ae29_a585c8cbc4f0__Power", + "guid": "9c513baf-b279-43fd-ae29-a585c8cbc4f0" + }, + "9ef0eb24-aae4-4f5a-99af-d724db44808f": { + "name": "FieldHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities\\String", + "code": "src\/9ef0eb24-aae4-4f5a-99af-d724db44808f\/code.php", + "power": "src\/9ef0eb24-aae4-4f5a-99af-d724db44808f\/code.power", + "settings": "src\/9ef0eb24-aae4-4f5a-99af-d724db44808f\/settings.json", + "path": "src\/9ef0eb24-aae4-4f5a-99af-d724db44808f", + "spk": "Super__9ef0eb24_aae4_4f5a_99af_d724db44808f__Power", + "guid": "9ef0eb24-aae4-4f5a-99af-d724db44808f" + }, + "a223b31e-ea1d-4cdf-92ae-5f9becffaff0": { + "name": "FileHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities", + "code": "src\/a223b31e-ea1d-4cdf-92ae-5f9becffaff0\/code.php", + "power": "src\/a223b31e-ea1d-4cdf-92ae-5f9becffaff0\/code.power", + "settings": "src\/a223b31e-ea1d-4cdf-92ae-5f9becffaff0\/settings.json", + "path": "src\/a223b31e-ea1d-4cdf-92ae-5f9becffaff0", + "spk": "Super__a223b31e_ea1d_4cdf_92ae_5f9becffaff0__Power", + "guid": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0" + }, + "a8935cbe-7701-40dc-bfd5-675f2d600954": { + "name": "TypeHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities\\String", + "code": "src\/a8935cbe-7701-40dc-bfd5-675f2d600954\/code.php", + "power": "src\/a8935cbe-7701-40dc-bfd5-675f2d600954\/code.power", + "settings": "src\/a8935cbe-7701-40dc-bfd5-675f2d600954\/settings.json", + "path": "src\/a8935cbe-7701-40dc-bfd5-675f2d600954", + "spk": "Super__a8935cbe_7701_40dc_bfd5_675f2d600954__Power", + "guid": "a8935cbe-7701-40dc-bfd5-675f2d600954" + }, + "ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48": { + "name": "InsertInterface", + "type": "interface", + "namespace": "VDM\\Joomla\\Interfaces", + "code": "src\/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48\/code.php", + "power": "src\/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48\/code.power", + "settings": "src\/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48\/settings.json", + "path": "src\/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48", + "spk": "Super__ad12ca1c_d3ce_4e7f_88c5_c6c92bdedc48__Power", + "guid": "ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48" + }, + "af0eedbe-603b-4671-8e5a-28165d88254b": { + "name": "Activeregistryinterface", + "type": "interface", + "namespace": "VDM\\Joomla\\Interfaces", + "code": "src\/af0eedbe-603b-4671-8e5a-28165d88254b\/code.php", + "power": "src\/af0eedbe-603b-4671-8e5a-28165d88254b\/code.power", + "settings": "src\/af0eedbe-603b-4671-8e5a-28165d88254b\/settings.json", + "path": "src\/af0eedbe-603b-4671-8e5a-28165d88254b", + "spk": "Super__af0eedbe_603b_4671_8e5a_28165d88254b__Power", + "guid": "af0eedbe-603b-4671-8e5a-28165d88254b" + }, + "b84e947d-2a13-44f7-ac0f-3902ae55ae0c": { + "name": "BaseRegistry", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Abstraction", + "code": "src\/b84e947d-2a13-44f7-ac0f-3902ae55ae0c\/code.php", + "power": "src\/b84e947d-2a13-44f7-ac0f-3902ae55ae0c\/code.power", + "settings": "src\/b84e947d-2a13-44f7-ac0f-3902ae55ae0c\/settings.json", + "path": "src\/b84e947d-2a13-44f7-ac0f-3902ae55ae0c", + "spk": "Super__b84e947d_2a13_44f7_ac0f_3902ae55ae0c__Power", + "guid": "b84e947d-2a13-44f7-ac0f-3902ae55ae0c" + }, + "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8": { + "name": "Table", + "type": "class", + "namespace": "VDM\\Joomla\\Componentbuilder", + "code": "src\/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8\/code.php", + "power": "src\/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8\/code.power", + "settings": "src\/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8\/settings.json", + "path": "src\/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8", + "spk": "Super__bfd1d6d5_56c1_4fe9_9fee_1c5910e1f5d8__Power", + "guid": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8" + }, + "c09e8968-c767-4175-bb3d-8432f206a2c7": { + "name": "IsArray", + "type": "trait", + "namespace": "VDM\\Joomla\\Abstraction\\Registry\\Traits", + "code": "src\/c09e8968-c767-4175-bb3d-8432f206a2c7\/code.php", + "power": "src\/c09e8968-c767-4175-bb3d-8432f206a2c7\/code.power", + "settings": "src\/c09e8968-c767-4175-bb3d-8432f206a2c7\/settings.json", + "path": "src\/c09e8968-c767-4175-bb3d-8432f206a2c7", + "spk": "Super__c09e8968_c767_4175_bb3d_8432f206a2c7__Power", + "guid": "c09e8968-c767-4175-bb3d-8432f206a2c7" + }, + "caf33c5d-858c-4f9a-894f-ab302ec5445a": { + "name": "FactoryInterface", + "type": "interface", + "namespace": "VDM\\Joomla\\Interfaces", + "code": "src\/caf33c5d-858c-4f9a-894f-ab302ec5445a\/code.php", + "power": "src\/caf33c5d-858c-4f9a-894f-ab302ec5445a\/code.power", + "settings": "src\/caf33c5d-858c-4f9a-894f-ab302ec5445a\/settings.json", + "path": "src\/caf33c5d-858c-4f9a-894f-ab302ec5445a", + "spk": "Super__caf33c5d_858c_4f9a_894f_ab302ec5445a__Power", + "guid": "caf33c5d-858c-4f9a-894f-ab302ec5445a" + }, + "cce56585-58b0-4f72-a92c-e2635ea52d83": { + "name": "Update", + "type": "final class", + "namespace": "VDM\\Joomla\\Database", + "code": "src\/cce56585-58b0-4f72-a92c-e2635ea52d83\/code.php", + "power": "src\/cce56585-58b0-4f72-a92c-e2635ea52d83\/code.power", + "settings": "src\/cce56585-58b0-4f72-a92c-e2635ea52d83\/settings.json", + "path": "src\/cce56585-58b0-4f72-a92c-e2635ea52d83", + "spk": "Super__cce56585_58b0_4f72_a92c_e2635ea52d83__Power", + "guid": "cce56585-58b0-4f72-a92c-e2635ea52d83" + }, + "cddcac51-9a46-47c4-ba59-105c70453bd6": { + "name": "FilterHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Utilities", + "code": "src\/cddcac51-9a46-47c4-ba59-105c70453bd6\/code.php", + "power": "src\/cddcac51-9a46-47c4-ba59-105c70453bd6\/code.power", + "settings": "src\/cddcac51-9a46-47c4-ba59-105c70453bd6\/settings.json", + "path": "src\/cddcac51-9a46-47c4-ba59-105c70453bd6", + "spk": "Super__cddcac51_9a46_47c4_ba59_105c70453bd6__Power", + "guid": "cddcac51-9a46-47c4-ba59-105c70453bd6" + }, + "ce8cf834-6bac-44fb-941c-861f7e046cc0": { + "name": "NamespaceHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities\\String", + "code": "src\/ce8cf834-6bac-44fb-941c-861f7e046cc0\/code.php", + "power": "src\/ce8cf834-6bac-44fb-941c-861f7e046cc0\/code.power", + "settings": "src\/ce8cf834-6bac-44fb-941c-861f7e046cc0\/settings.json", + "path": "src\/ce8cf834-6bac-44fb-941c-861f7e046cc0", + "spk": "Super__ce8cf834_6bac_44fb_941c_861f7e046cc0__Power", + "guid": "ce8cf834-6bac-44fb-941c-861f7e046cc0" + }, + "db87c339-5bb6-4291-a7ef-2c48ea1b06bc": { + "name": "GetHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities", + "code": "src\/db87c339-5bb6-4291-a7ef-2c48ea1b06bc\/code.php", + "power": "src\/db87c339-5bb6-4291-a7ef-2c48ea1b06bc\/code.power", + "settings": "src\/db87c339-5bb6-4291-a7ef-2c48ea1b06bc\/settings.json", + "path": "src\/db87c339-5bb6-4291-a7ef-2c48ea1b06bc", + "spk": "Super__db87c339_5bb6_4291_a7ef_2c48ea1b06bc__Power", + "guid": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc" + }, + "e0f6ddbe-2a35-4537-942c-faff2ebd04f6": { + "name": "BaseTable", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Abstraction", + "code": "src\/e0f6ddbe-2a35-4537-942c-faff2ebd04f6\/code.php", + "power": "src\/e0f6ddbe-2a35-4537-942c-faff2ebd04f6\/code.power", + "settings": "src\/e0f6ddbe-2a35-4537-942c-faff2ebd04f6\/settings.json", + "path": "src\/e0f6ddbe-2a35-4537-942c-faff2ebd04f6", + "spk": "Super__e0f6ddbe_2a35_4537_942c_faff2ebd04f6__Power", + "guid": "e0f6ddbe-2a35-4537-942c-faff2ebd04f6" + }, + "ff7d0111-8f79-42aa-ac14-b53ba2c49369": { + "name": "IsString", + "type": "trait", + "namespace": "VDM\\Joomla\\Abstraction\\Registry\\Traits", + "code": "src\/ff7d0111-8f79-42aa-ac14-b53ba2c49369\/code.php", + "power": "src\/ff7d0111-8f79-42aa-ac14-b53ba2c49369\/code.power", + "settings": "src\/ff7d0111-8f79-42aa-ac14-b53ba2c49369\/settings.json", + "path": "src\/ff7d0111-8f79-42aa-ac14-b53ba2c49369", + "spk": "Super__ff7d0111_8f79_42aa_ac14_b53ba2c49369__Power", + "guid": "ff7d0111-8f79-42aa-ac14-b53ba2c49369" + }, + "ffbd4e1f-a342-4080-ab7d-1de3741bf319": { + "name": "BaseConfig", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Abstraction", + "code": "src\/ffbd4e1f-a342-4080-ab7d-1de3741bf319\/code.php", + "power": "src\/ffbd4e1f-a342-4080-ab7d-1de3741bf319\/code.power", + "settings": "src\/ffbd4e1f-a342-4080-ab7d-1de3741bf319\/settings.json", + "path": "src\/ffbd4e1f-a342-4080-ab7d-1de3741bf319", + "spk": "Super__ffbd4e1f_a342_4080_ab7d_1de3741bf319__Power", + "guid": "ffbd4e1f-a342-4080-ab7d-1de3741bf319" + } +} \ No newline at end of file