diff --git a/README.md b/README.md index db8e090..e3024ea 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,11 @@ This repository contains an index (see below) of all the approved powers within - **class Placeholder** | [Details](src/06453ada-e370-49f0-b262-e3f5a8ed0c2c) | [Code](src/06453ada-e370-49f0-b262-e3f5a8ed0c2c/code.php) | [Settings](src/06453ada-e370-49f0-b262-e3f5a8ed0c2c/settings.json) | SPK: `Super---06453ada_e370_49f0_b262_e3f5a8ed0c2c---Power` - **class Power** | [Details](src/b836c1b1-b6b1-44f7-b8a2-9a763a4185b1) | [Code](src/b836c1b1-b6b1-44f7-b8a2-9a763a4185b1/code.php) | [Settings](src/b836c1b1-b6b1-44f7-b8a2-9a763a4185b1/settings.json) | SPK: `Super---b836c1b1_b6b1_44f7_b8a2_9a763a4185b1---Power` - **class Registry** | [Details](src/e5d9804f-0eb0-4ee9-b406-ad4e8cdbc1f6) | [Code](src/e5d9804f-0eb0-4ee9-b406-ad4e8cdbc1f6/code.php) | [Settings](src/e5d9804f-0eb0-4ee9-b406-ad4e8cdbc1f6/settings.json) | SPK: `Super---e5d9804f_0eb0_4ee9_b406_ad4e8cdbc1f6---Power` +- **Namespace**: [VDM\Joomla\Componentbuilder\Fieldtype](#vdm-joomla-componentbuilder-fieldtype) + + - **abstract class Factory** | [Details](src/469608a8-72ba-4bad-8233-80a4127c72a8) | [Code](src/469608a8-72ba-4bad-8233-80a4127c72a8/code.php) | [Settings](src/469608a8-72ba-4bad-8233-80a4127c72a8/settings.json) | SPK: `Super---469608a8_72ba_4bad_8233_80a4127c72a8---Power` + - **final class Grep** | [Details](src/d8d35836-60f2-4464-a306-097f079c4f13) | [Code](src/d8d35836-60f2-4464-a306-097f079c4f13/code.php) | [Settings](src/d8d35836-60f2-4464-a306-097f079c4f13/settings.json) | SPK: `Super---d8d35836_60f2_4464_a306_097f079c4f13---Power` + - **class Config** | [Details](src/baf83354-0be5-410e-80f9-2b64b052e482) | [Code](src/baf83354-0be5-410e-80f9-2b64b052e482/code.php) | [Settings](src/baf83354-0be5-410e-80f9-2b64b052e482/settings.json) | SPK: `Super---baf83354_0be5_410e_80f9_2b64b052e482---Power` - **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces](#vdm-joomla-componentbuilder-interfaces) - **interface Cryptinterface** | [Details](src/81de8f57-dd9c-4a17-964f-848cd4a0743b) | [Code](src/81de8f57-dd9c-4a17-964f-848cd4a0743b/code.php) | [Settings](src/81de8f57-dd9c-4a17-964f-848cd4a0743b/settings.json) | SPK: `Super---81de8f57_dd9c_4a17_964f_848cd4a0743b---Power` @@ -345,6 +350,7 @@ This repository contains an index (see below) of all the approved powers within - **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Service](#vdm-joomla-componentbuilder-compiler-service) - **class Adminview** | [Details](src/2dd1289a-4000-43cc-8c62-77ff32de56bf) | [Code](src/2dd1289a-4000-43cc-8c62-77ff32de56bf/code.php) | [Settings](src/2dd1289a-4000-43cc-8c62-77ff32de56bf/settings.json) | SPK: `Super---2dd1289a_4000_43cc_8c62_77ff32de56bf---Power` + - **class ArchitectureComHelperClass** | [Details](src/8cd3c4aa-8daf-4e40-a943-456f46112c7b) | [Code](src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/code.php) | [Settings](src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/settings.json) | SPK: `Super---8cd3c4aa_8daf_4e40_a943_456f46112c7b---Power` - **class ArchitectureController** | [Details](src/56ba30f5-a5c4-4c4c-be6f-a56f7f9cbc60) | [Code](src/56ba30f5-a5c4-4c4c-be6f-a56f7f9cbc60/code.php) | [Settings](src/56ba30f5-a5c4-4c4c-be6f-a56f7f9cbc60/settings.json) | SPK: `Super---56ba30f5_a5c4_4c4c_be6f_a56f7f9cbc60---Power` - **class ArchitectureModel** | [Details](src/bbd36fbf-d905-47e8-8e67-9ea6ec734712) | [Code](src/bbd36fbf-d905-47e8-8e67-9ea6ec734712/code.php) | [Settings](src/bbd36fbf-d905-47e8-8e67-9ea6ec734712/settings.json) | SPK: `Super---bbd36fbf_d905_47e8_8e67_9ea6ec734712---Power` - **class ArchitecturePlugin** | [Details](src/98ac432d-df19-4c40-bb12-8104ea4362c8) | [Code](src/98ac432d-df19-4c40-bb12-8104ea4362c8/code.php) | [Settings](src/98ac432d-df19-4c40-bb12-8104ea4362c8/settings.json) | SPK: `Super---98ac432d_df19_4c40_bb12_8104ea4362c8---Power` @@ -390,6 +396,17 @@ This repository contains an index (see below) of all the approved powers within - **class Pathfix** | [Details](src/cdc9b06d-8333-4fa7-ab4d-b810dd90f95f) | [Code](src/cdc9b06d-8333-4fa7-ab4d-b810dd90f95f/code.php) | [Settings](src/cdc9b06d-8333-4fa7-ab4d-b810dd90f95f/settings.json) | SPK: `Super---cdc9b06d_8333_4fa7_ab4d_b810dd90f95f---Power` - **class Paths** | [Details](src/6f20369a-8536-4870-a1a3-cda254c939c8) | [Code](src/6f20369a-8536-4870-a1a3-cda254c939c8/code.php) | [Settings](src/6f20369a-8536-4870-a1a3-cda254c939c8/settings.json) | SPK: `Super---6f20369a_8536_4870_a1a3_cda254c939c8---Power` - **class Structure** | [Details](src/1efdded5-d6c8-452c-8f37-0374483a7b3f) | [Code](src/1efdded5-d6c8-452c-8f37-0374483a7b3f/code.php) | [Settings](src/1efdded5-d6c8-452c-8f37-0374483a7b3f/settings.json) | SPK: `Super---1efdded5_d6c8_452c_8f37_0374483a7b3f---Power` +- **Namespace**: [VDM\Joomla\Componentbuilder\Fieldtype\Readme](#vdm-joomla-componentbuilder-fieldtype-readme) + + - **final class Item** | [Details](src/35d9a31b-2b5d-4cbb-9763-299cacc76128) | [Code](src/35d9a31b-2b5d-4cbb-9763-299cacc76128/code.php) | [Settings](src/35d9a31b-2b5d-4cbb-9763-299cacc76128/settings.json) | SPK: `Super---35d9a31b_2b5d_4cbb_9763_299cacc76128---Power` + - **final class Main** | [Details](src/927fc3eb-9332-43ec-b903-ce16dcf6df09) | [Code](src/927fc3eb-9332-43ec-b903-ce16dcf6df09/code.php) | [Settings](src/927fc3eb-9332-43ec-b903-ce16dcf6df09/settings.json) | SPK: `Super---927fc3eb_9332_43ec_b903_ce16dcf6df09---Power` +- **Namespace**: [VDM\Joomla\Componentbuilder\Fieldtype\Remote](#vdm-joomla-componentbuilder-fieldtype-remote) + + - **final class Get** | [Details](src/3235d233-ba17-4a4a-9078-aeb8c8716c04) | [Code](src/3235d233-ba17-4a4a-9078-aeb8c8716c04/code.php) | [Settings](src/3235d233-ba17-4a4a-9078-aeb8c8716c04/settings.json) | SPK: `Super---3235d233_ba17_4a4a_9078_aeb8c8716c04---Power` + - **final class Set** | [Details](src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8) | [Code](src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/code.php) | [Settings](src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/settings.json) | SPK: `Super---d45b9f58_e4d7_4b0a_be05_e34c6fa215c8---Power` +- **Namespace**: [VDM\Joomla\Componentbuilder\Fieldtype\Service](#vdm-joomla-componentbuilder-fieldtype-service) + + - **class Fieldtype** | [Details](src/4adfb171-2580-4d57-8fbb-fb92cfd11046) | [Code](src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.php) | [Settings](src/4adfb171-2580-4d57-8fbb-fb92cfd11046/settings.json) | SPK: `Super---4adfb171_2580_4d57_8fbb_fb92cfd11046---Power` - **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces\Plugin](#vdm-joomla-componentbuilder-interfaces-plugin) - **interface InfusionInterface** | [Details](src/40e17114-2193-4a61-9233-47b5f4193665) | [Code](src/40e17114-2193-4a61-9233-47b5f4193665/code.php) | [Settings](src/40e17114-2193-4a61-9233-47b5f4193665/settings.json) | SPK: `Super---40e17114_2193_4a61_9233_47b5f4193665---Power` @@ -520,6 +537,9 @@ This repository contains an index (see below) of all the approved powers within - **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces\Architecture\Plugin](#vdm-joomla-componentbuilder-interfaces-architecture-plugin) - **interface MainXMLInterface** | [Details](src/97177ca9-a51a-4d24-81e1-8747b6e7d76c) | [Code](src/97177ca9-a51a-4d24-81e1-8747b6e7d76c/code.php) | [Settings](src/97177ca9-a51a-4d24-81e1-8747b6e7d76c/settings.json) | SPK: `Super---97177ca9_a51a_4d24_81e1_8747b6e7d76c---Power` +- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\ComHelperClass](#vdm-joomla-componentbuilder-compiler-architecture-joomlafive-comhelperclass) + + - **final class CreateUser** | [Details](src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa) | [Code](src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/code.php) | [Settings](src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/settings.json) | SPK: `Super---0b02ece5_4968_4e65_bf71_5999c4d8c4aa---Power` - **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\Controller](#vdm-joomla-componentbuilder-compiler-architecture-joomlafive-controller) - **final class AllowAdd** | [Details](src/005fce79-1b62-4a93-8d5e-8c89fee1afc6) | [Code](src/005fce79-1b62-4a93-8d5e-8c89fee1afc6/code.php) | [Settings](src/005fce79-1b62-4a93-8d5e-8c89fee1afc6/settings.json) | SPK: `Super---005fce79_1b62_4a93_8d5e_8c89fee1afc6---Power` @@ -534,6 +554,9 @@ This repository contains an index (see below) of all the approved powers within - **final class Extension** | [Details](src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d) | [Code](src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/code.php) | [Settings](src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/settings.json) | SPK: `Super---28c8eed4_58cf_4d40_9053_ad77b6edfa9d---Power` - **final class MainXML** | [Details](src/a7124f78-21c5-400e-984d-4c5463cb2315) | [Code](src/a7124f78-21c5-400e-984d-4c5463cb2315/code.php) | [Settings](src/a7124f78-21c5-400e-984d-4c5463cb2315/settings.json) | SPK: `Super---a7124f78_21c5_400e_984d_4c5463cb2315---Power` - **final class Provider** | [Details](src/63865266-62e0-40bd-820c-e95449d12982) | [Code](src/63865266-62e0-40bd-820c-e95449d12982/code.php) | [Settings](src/63865266-62e0-40bd-820c-e95449d12982/settings.json) | SPK: `Super---63865266_62e0_40bd_820c_e95449d12982---Power` +- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\ComHelperClass](#vdm-joomla-componentbuilder-compiler-architecture-joomlafour-comhelperclass) + + - **final class CreateUser** | [Details](src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3) | [Code](src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/code.php) | [Settings](src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/settings.json) | SPK: `Super---ecf774ca_82d9_42e1_a1b5_903c6ca9efe3---Power` - **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\Controller](#vdm-joomla-componentbuilder-compiler-architecture-joomlafour-controller) - **final class AllowAdd** | [Details](src/425b1107-933d-4436-87ac-63540ec101c5) | [Code](src/425b1107-933d-4436-87ac-63540ec101c5/code.php) | [Settings](src/425b1107-933d-4436-87ac-63540ec101c5/settings.json) | SPK: `Super---425b1107_933d_4436_87ac_63540ec101c5---Power` @@ -548,6 +571,9 @@ This repository contains an index (see below) of all the approved powers within - **final class Extension** | [Details](src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa) | [Code](src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/code.php) | [Settings](src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/settings.json) | SPK: `Super---ec808f55_6703_46c0_8a6d_33c9d4e0e9fa---Power` - **final class MainXML** | [Details](src/af6d0e6a-61d2-4250-9e2f-bed5591e2786) | [Code](src/af6d0e6a-61d2-4250-9e2f-bed5591e2786/code.php) | [Settings](src/af6d0e6a-61d2-4250-9e2f-bed5591e2786/settings.json) | SPK: `Super---af6d0e6a_61d2_4250_9e2f_bed5591e2786---Power` - **final class Provider** | [Details](src/60c3ccc5-36dc-4480-b5c4-252c37212f61) | [Code](src/60c3ccc5-36dc-4480-b5c4-252c37212f61/code.php) | [Settings](src/60c3ccc5-36dc-4480-b5c4-252c37212f61/settings.json) | SPK: `Super---60c3ccc5_36dc_4480_b5c4_252c37212f61---Power` +- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\ComHelperClass](#vdm-joomla-componentbuilder-compiler-architecture-joomlathree-comhelperclass) + + - **final class CreateUser** | [Details](src/8c7abe76-516e-4c4f-97c1-244ca43b7726) | [Code](src/8c7abe76-516e-4c4f-97c1-244ca43b7726/code.php) | [Settings](src/8c7abe76-516e-4c4f-97c1-244ca43b7726/settings.json) | SPK: `Super---8c7abe76_516e_4c4f_97c1_244ca43b7726---Power` - **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\Controller](#vdm-joomla-componentbuilder-compiler-architecture-joomlathree-controller) - **final class AllowAdd** | [Details](src/f21388dc-5ddc-4970-a3c2-55f075024762) | [Code](src/f21388dc-5ddc-4970-a3c2-55f075024762/code.php) | [Settings](src/f21388dc-5ddc-4970-a3c2-55f075024762/settings.json) | SPK: `Super---f21388dc_5ddc_4970_a3c2_55f075024762---Power` @@ -562,6 +588,9 @@ This repository contains an index (see below) of all the approved powers within - **final class Extension** | [Details](src/a5f658ff-3962-475d-8cf8-c91da562bf49) | [Code](src/a5f658ff-3962-475d-8cf8-c91da562bf49/code.php) | [Settings](src/a5f658ff-3962-475d-8cf8-c91da562bf49/settings.json) | SPK: `Super---a5f658ff_3962_475d_8cf8_c91da562bf49---Power` - **final class MainXML** | [Details](src/54e05f58-6538-42ec-ba46-b136f33e7cc7) | [Code](src/54e05f58-6538-42ec-ba46-b136f33e7cc7/code.php) | [Settings](src/54e05f58-6538-42ec-ba46-b136f33e7cc7/settings.json) | SPK: `Super---54e05f58_6538_42ec_ba46_b136f33e7cc7---Power` - **final class Provider** | [Details](src/6dd2d394-8dde-4eb7-8505-cd7d345c49e3) | [Code](src/6dd2d394-8dde-4eb7-8505-cd7d345c49e3/code.php) | [Settings](src/6dd2d394-8dde-4eb7-8505-cd7d345c49e3/settings.json) | SPK: `Super---6dd2d394_8dde_4eb7_8505_cd7d345c49e3---Power` +- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass](#vdm-joomla-componentbuilder-compiler-interfaces-architecture-comhelperclass) + + - **interface CreateUserInterface** | [Details](src/5247cc17-b620-4cf3-9a1e-d0589b36ab35) | [Code](src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/code.php) | [Settings](src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/settings.json) | SPK: `Super---5247cc17_b620_4cf3_9a1e_d0589b36ab35---Power` - **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\Controller](#vdm-joomla-componentbuilder-compiler-interfaces-architecture-controller) - **interface AllowAddInterface** | [Details](src/c9700450-4f44-4455-bc86-6a7660daadee) | [Code](src/c9700450-4f44-4455-bc86-6a7660daadee/code.php) | [Settings](src/c9700450-4f44-4455-bc86-6a7660daadee/settings.json) | SPK: `Super---c9700450_4f44_4455_bc86_6a7660daadee---Power` diff --git a/src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/code.php b/src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/code.php index 0ef7008..46e1632 100644 --- a/src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/code.php +++ b/src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/code.php @@ -787,7 +787,7 @@ class Extractor implements ExtractorInterface $query->columns($this->db->quoteName($columns)); foreach ($this->new as $values) { - if (count((array) $values) == 15) + if (count((array) $values) == 16) { $query->values(implode(',', $values)); $continue = true; diff --git a/src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/code.power b/src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/code.power index 4a490db..5c04c35 100644 --- a/src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/code.power +++ b/src/01411bb1-fdd6-4cca-84d7-1b62d93c70c1/code.power @@ -715,7 +715,7 @@ $query->columns($this->db->quoteName($columns)); foreach ($this->new as $values) { - if (count((array) $values) == 15) + if (count((array) $values) == 16) { $query->values(implode(',', $values)); $continue = true; diff --git a/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/README.md b/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/README.md new file mode 100644 index 0000000..70ca086 --- /dev/null +++ b/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/README.md @@ -0,0 +1,55 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class CreateUser (Details) +> namespace: **VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\ComHelperClass** + +```uml +@startuml +class CreateUser << (F,LightGreen) >> #RoyalBlue { + + get($add) : string +} + +note right of CreateUser::get + Generates the method definition for creating or updating a user based on the provided parameters. +This method returns a string representation of a PHP function that includes various +steps for handling user creation and updates, depending on the mode (site registration or admin registration). +If true, the method will be generated and returned as a string. +Returns an empty string if $add is false. + + return: string +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---0b02ece5_4968_4e65_bf71_5999c4d8c4aa---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/code.php b/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/code.php new file mode 100644 index 0000000..a0a53e5 --- /dev/null +++ b/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/code.php @@ -0,0 +1,127 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\ComHelperClass; + + +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface; + + +/** + * Helper Class Create User Class for Joomla 5 + * + * @since 5.0.2 + */ +final class CreateUser implements CreateUserInterface +{ + /** + * Generates the method definition for creating or updating a user based on the provided parameters. + * + * This method returns a string representation of a PHP function that includes various + * steps for handling user creation and updates, depending on the mode (site registration or admin registration). + * + * @param $add Determines whether to generate the user creation method or not. + * If true, the method will be generated and returned as a string. + * + * @return string The generated method code as a string if $add is true. + * Returns an empty string if $add is false. + */ + public function get($add): string + { + if ($add) + { + $method = []; + $method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Save user details by either creating a new user or updating an existing user."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) + . " * @param array \$credentials ['name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string]"; + $method[] = Indent::_(1) . " * @param int \$autologin"; + $method[] = Indent::_(1) + . " * @param array \$params ['useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int]"; + $method[] = Indent::_(1) + . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @return int User ID on success"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @throws \InvalidArgumentException If required credentials are missing."; + $method[] = Indent::_(1) . " * @throws \RuntimeException If the user update or creation fails."; + $method[] = Indent::_(1) . " * @throws Super__"."_1c10a5f1_204d_4f17_ad9f_0e0684f2030d___Power If the user is not found."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);"; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function createUser(\$credentials, \$autologin = 0,"; + $method[] = Indent::_(2) . "\$params = ["; + $method[] = Indent::_(3) + . "'useractivation' => 0, 'sendpassword' => 1"; + $method[] = Indent::_(2) . "], \$mode = 1"; + $method[] = Indent::_(1) . ")"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Create a user with the UserHelper class (Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power)"; + $method[] = Indent::_(2) + . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Update the given component params."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @param string|null \$option The optional extension element name."; + $method[] = Indent::_(1) . " * @param string \$target The parameter name to be updated."; + $method[] = Indent::_(1) . " * @param mixed \$value The value to set for the parameter."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);"; + $method[] = Indent::_(1) . " */"; + $method[] = PHP_EOL . Indent::_(1) + . "public static function setParams(\$option, \$target, \$value)"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Sets a parameter value for the given target in the specified option's params"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " (Super---640b5352_fb09_425f_a26e_cd44eda03f15---Power)"; + $method[] = Indent::_(2) + . "return Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Update user details"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @param array \$userDetails Array containing user details to be updated"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @return int Updated user ID on success."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @throws \RuntimeException If user update fails."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);"; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function updateUser(\$userDetails): int"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) + . "//" . Line::_(__Line__, __Class__) + . " Update user details with the UserHelper class (Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power)"; + $method[] = Indent::_(2) . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);"; + $method[] = Indent::_(1) . "}"; + + // return the help method + return implode(PHP_EOL, $method); + } + + return ''; + } +} + diff --git a/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/code.power b/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/code.power new file mode 100644 index 0000000..c7c9b03 --- /dev/null +++ b/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/code.power @@ -0,0 +1,99 @@ + /** + * Generates the method definition for creating or updating a user based on the provided parameters. + * + * This method returns a string representation of a PHP function that includes various + * steps for handling user creation and updates, depending on the mode (site registration or admin registration). + * + * @param $add Determines whether to generate the user creation method or not. + * If true, the method will be generated and returned as a string. + * + * @return string The generated method code as a string if $add is true. + * Returns an empty string if $add is false. + */ + public function get($add): string + { + if ($add) + { + $method = []; + $method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Save user details by either creating a new user or updating an existing user."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) + . " * @param array \$credentials ['name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string]"; + $method[] = Indent::_(1) . " * @param int \$autologin"; + $method[] = Indent::_(1) + . " * @param array \$params ['useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int]"; + $method[] = Indent::_(1) + . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @return int User ID on success"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @throws \InvalidArgumentException If required credentials are missing."; + $method[] = Indent::_(1) . " * @throws \RuntimeException If the user update or creation fails."; + $method[] = Indent::_(1) . " * @throws Super__"."_1c10a5f1_204d_4f17_ad9f_0e0684f2030d___Power If the user is not found."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);"; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function createUser(\$credentials, \$autologin = 0,"; + $method[] = Indent::_(2) . "\$params = ["; + $method[] = Indent::_(3) + . "'useractivation' => 0, 'sendpassword' => 1"; + $method[] = Indent::_(2) . "], \$mode = 1"; + $method[] = Indent::_(1) . ")"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Create a user with the UserHelper class (Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power)"; + $method[] = Indent::_(2) + . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Update the given component params."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @param string|null \$option The optional extension element name."; + $method[] = Indent::_(1) . " * @param string \$target The parameter name to be updated."; + $method[] = Indent::_(1) . " * @param mixed \$value The value to set for the parameter."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);"; + $method[] = Indent::_(1) . " */"; + $method[] = PHP_EOL . Indent::_(1) + . "public static function setParams(\$option, \$target, \$value)"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Sets a parameter value for the given target in the specified option's params"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " (Super---640b5352_fb09_425f_a26e_cd44eda03f15---Power)"; + $method[] = Indent::_(2) + . "return Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Update user details"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @param array \$userDetails Array containing user details to be updated"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @return int Updated user ID on success."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @throws \RuntimeException If user update fails."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);"; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function updateUser(\$userDetails): int"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) + . "//" . Line::_(__Line__, __Class__) + . " Update user details with the UserHelper class (Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power)"; + $method[] = Indent::_(2) . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);"; + $method[] = Indent::_(1) . "}"; + + // return the help method + return implode(PHP_EOL, $method); + } + + return ''; + } \ No newline at end of file diff --git a/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/settings.json b/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/settings.json new file mode 100644 index 0000000..2a86846 --- /dev/null +++ b/src/0b02ece5-4968-4e65-bf71-5999c4d8c4aa/settings.json @@ -0,0 +1,30 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "", + "guid": "0b02ece5-4968-4e65-bf71-5999c4d8c4aa", + "implements": [ + "5247cc17-b620-4cf3-9a1e-d0589b36ab35" + ], + "load_selection": null, + "name": "CreateUser", + "power_version": "1.0.0", + "system_name": "JCB.Architecture.J5.ComHelperClass.CreateUser", + "type": "final class", + "use_selection": { + "use_selection0": { + "use": "a68c010b-e92e-47d5-8a44-d23cfddeb6c6", + "as": "default" + }, + "use_selection1": { + "use": "4e6ff11d-bebf-42f5-8fd7-b2f882857222", + "as": "default" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Compiler.Architecture.JoomlaFive.ComHelperClass.CreateUser", + "description": "Helper Class Create User Class for Joomla 5\r\n\r\n@since 5.0.2", + "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/12df35ad-2d44-4c4c-a7d5-a3350932a520/code.php b/src/12df35ad-2d44-4c4c-a7d5-a3350932a520/code.php index ddf57c2..434f7f9 100644 --- a/src/12df35ad-2d44-4c4c-a7d5-a3350932a520/code.php +++ b/src/12df35ad-2d44-4c4c-a7d5-a3350932a520/code.php @@ -36,13 +36,13 @@ final class Groups 'color', 'combo', 'componentlayout', 'contentlanguage', 'contenttype', 'databaseconnection', 'components', 'editor', 'editors', 'email', 'file', 'file', 'filelist', 'folderlist', 'groupedlist', 'headertag', 'helpsite', 'hidden', 'imagelist', 'integer', 'language', 'list', 'media', 'menu', 'modal_menu', 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduleposition', - 'moduletag', 'note', 'number', 'password', 'plugins', 'predefinedlist', 'radio', 'range', 'repeatable', 'rules', + 'moduletag', 'note', 'number', 'password', 'plugins', 'predefinedlist', 'radio', 'range', 'repeatable', 'rules', 'usergrouplist', 'sessionhandler', 'spacer', 'sql', 'subform', 'tag', 'tel', 'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup' ], 'plain' => [ 'cachehandler', 'calendar', 'checkbox', 'chromestyle', 'color', 'componentlayout', 'contenttype', 'editor', 'editors', 'captcha', 'email', 'file', 'headertag', 'helpsite', 'hidden', 'integer', 'language', 'media', 'menu', 'modal_menu', 'menuitem', 'meter', 'modulelayout', 'templatestyle', - 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', 'tag', 'tel', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup' + 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', 'tag', 'tel', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup' , 'usergrouplist' ], 'option' => [ 'accesslevel', 'category', 'checkboxes', 'combo', 'contentlanguage', 'databaseconnection', 'components', diff --git a/src/12df35ad-2d44-4c4c-a7d5-a3350932a520/code.power b/src/12df35ad-2d44-4c4c-a7d5-a3350932a520/code.power index 92bb72b..68436f8 100644 --- a/src/12df35ad-2d44-4c4c-a7d5-a3350932a520/code.power +++ b/src/12df35ad-2d44-4c4c-a7d5-a3350932a520/code.power @@ -10,13 +10,13 @@ 'color', 'combo', 'componentlayout', 'contentlanguage', 'contenttype', 'databaseconnection', 'components', 'editor', 'editors', 'email', 'file', 'file', 'filelist', 'folderlist', 'groupedlist', 'headertag', 'helpsite', 'hidden', 'imagelist', 'integer', 'language', 'list', 'media', 'menu', 'modal_menu', 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduleposition', - 'moduletag', 'note', 'number', 'password', 'plugins', 'predefinedlist', 'radio', 'range', 'repeatable', 'rules', + 'moduletag', 'note', 'number', 'password', 'plugins', 'predefinedlist', 'radio', 'range', 'repeatable', 'rules', 'usergrouplist', 'sessionhandler', 'spacer', 'sql', 'subform', 'tag', 'tel', 'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup' ], 'plain' => [ 'cachehandler', 'calendar', 'checkbox', 'chromestyle', 'color', 'componentlayout', 'contenttype', 'editor', 'editors', 'captcha', 'email', 'file', 'headertag', 'helpsite', 'hidden', 'integer', 'language', 'media', 'menu', 'modal_menu', 'menuitem', 'meter', 'modulelayout', 'templatestyle', - 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', 'tag', 'tel', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup' + 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', 'tag', 'tel', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup' , 'usergrouplist' ], 'option' => [ 'accesslevel', 'category', 'checkboxes', 'combo', 'contentlanguage', 'databaseconnection', 'components', diff --git a/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/README.md b/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/README.md index 4eacafc..f329616 100644 --- a/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/README.md +++ b/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/README.md @@ -19,6 +19,7 @@ class Extension << (F,LightGreen) >> #RoyalBlue { + get(object $plugin) : string # addNeededMethods(string $code) : bool # addGetSubscribedEvents(array $methods) : ?string + # validEventName(array $method) : bool # getSubscribedEvents(array $methods) : bool } @@ -57,6 +58,16 @@ note right of Extension::addGetSubscribedEvents return: ?string end note +note right of Extension::validEventName + Validates if a method name is a valid event name for a Joomla plugin. +The method must meet the following criteria: +- It must be public, not static, and not abstract. +- It must not be a magic method (i.e., should not start with '__'). + + since: 5.0.2 + return: bool +end note + note right of Extension::getSubscribedEvents Check if the getSubscribedEvents is set diff --git a/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/code.php b/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/code.php index d3218db..b30514a 100644 --- a/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/code.php +++ b/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/code.php @@ -155,7 +155,7 @@ final class Extension implements ExtensionInterface $counter = 0; foreach ($methods as $method) { - if ($method['access'] === 'public' && !$method['static'] && !$method['abstract']) + if ($this->validEventName($method)) { $events[$method['name']] = Indent::_(3) . "'{$method['name']}' => '{$method['name']}'"; @@ -191,6 +191,37 @@ final class Extension implements ExtensionInterface return implode(PHP_EOL, $method); } + /** + * Validates if a method name is a valid event name for a Joomla plugin. + * + * The method must meet the following criteria: + * - It must be public, not static, and not abstract. + * - It must not be a magic method (i.e., should not start with '__'). + * + * @param array $method The method details, including 'name', 'access', 'static', and 'abstract'. + * + * @return bool Returns true if the method is a valid event name, otherwise false. + * + * @since 5.0.2 + */ + protected function validEventName(array $method): bool + { + // Check if the method is public, static, and not abstract + if ($method['access'] !== 'public' || $method['static'] || $method['abstract']) + { + return false; + } + + // Check if the method is a magic method (starts with '__') + if (substr($method['name'], 0, 2) === '__') + { + return false; + } + + // If all checks pass, the method is a valid event name + return true; + } + /** * Check if the getSubscribedEvents is set * diff --git a/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/code.power b/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/code.power index a70193c..cec6009 100644 --- a/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/code.power +++ b/src/28c8eed4-58cf-4d40-9053-ad77b6edfa9d/code.power @@ -127,7 +127,7 @@ $counter = 0; foreach ($methods as $method) { - if ($method['access'] === 'public' && !$method['static'] && !$method['abstract']) + if ($this->validEventName($method)) { $events[$method['name']] = Indent::_(3) . "'{$method['name']}' => '{$method['name']}'"; @@ -163,6 +163,37 @@ return implode(PHP_EOL, $method); } + /** + * Validates if a method name is a valid event name for a Joomla plugin. + * + * The method must meet the following criteria: + * - It must be public, not static, and not abstract. + * - It must not be a magic method (i.e., should not start with '__'). + * + * @param array $method The method details, including 'name', 'access', 'static', and 'abstract'. + * + * @return bool Returns true if the method is a valid event name, otherwise false. + * + * @since 5.0.2 + */ + protected function validEventName(array $method): bool + { + // Check if the method is public, static, and not abstract + if ($method['access'] !== 'public' || $method['static'] || $method['abstract']) + { + return false; + } + + // Check if the method is a magic method (starts with '__') + if (substr($method['name'], 0, 2) === '__') + { + return false; + } + + // If all checks pass, the method is a valid event name + return true; + } + /** * Check if the getSubscribedEvents is set * diff --git a/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/README.md b/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/README.md new file mode 100644 index 0000000..22d95bd --- /dev/null +++ b/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/README.md @@ -0,0 +1,46 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Get (Details) +> namespace: **VDM\Joomla\Componentbuilder\Fieldtype\Remote** +> extends: **ExtendingGet** + +```uml +@startuml +class Get << (F,LightGreen) >> #RoyalBlue { + # string $table +} + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---3235d233_ba17_4a4a_9078_aeb8c8716c04---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/code.php b/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/code.php new file mode 100644 index 0000000..4f004f3 --- /dev/null +++ b/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/code.php @@ -0,0 +1,34 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Fieldtype\Remote; + + +use VDM\Joomla\Interfaces\Remote\GetInterface; +use VDM\Joomla\Abstraction\Remote\Get as ExtendingGet; + + +/** + * Remote Get Field Type of JCB + * + * @since 5.0.3 + */ +final class Get extends ExtendingGet implements GetInterface +{ + /** + * Table Name + * + * @var string + * @since 5.0.3 + */ + protected string $table = 'fieldtype'; +} + diff --git a/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/code.power b/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/code.power new file mode 100644 index 0000000..186dc41 --- /dev/null +++ b/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/code.power @@ -0,0 +1,7 @@ + /** + * Table Name + * + * @var string + * @since 5.0.3 + */ + protected string $table = 'fieldtype'; \ No newline at end of file diff --git a/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/settings.json b/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/settings.json new file mode 100644 index 0000000..eb69b49 --- /dev/null +++ b/src/3235d233-ba17-4a4a-9078-aeb8c8716c04/settings.json @@ -0,0 +1,21 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "728ee726-3f0f-4762-899d-f8c9430cee58", + "guid": "3235d233-ba17-4a4a-9078-aeb8c8716c04", + "implements": [ + "51de80f2-2868-4c2c-8198-ef79349e9bd7" + ], + "load_selection": null, + "name": "Get", + "power_version": "1.0.0", + "system_name": "JCB.Fieldtype.Remote.Get", + "type": "final class", + "use_selection": null, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Fieldtype.Remote.Get", + "description": "Remote Get Field Type of JCB\r\n\r\n@since 5.0.3", + "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/35d9a31b-2b5d-4cbb-9763-299cacc76128/README.md b/src/35d9a31b-2b5d-4cbb-9763-299cacc76128/README.md new file mode 100644 index 0000000..3904c82 --- /dev/null +++ b/src/35d9a31b-2b5d-4cbb-9763-299cacc76128/README.md @@ -0,0 +1,52 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Item (Details) +> namespace: **VDM\Joomla\Componentbuilder\Fieldtype\Readme** + +```uml +@startuml +class Item << (F,LightGreen) >> #RoyalBlue { + + get(object $item) : string +} + +note right of Item::get + Get an item readme + + since: 3.2.2 + return: string +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---35d9a31b_2b5d_4cbb_9763_299cacc76128---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/35d9a31b-2b5d-4cbb-9763-299cacc76128/code.php b/src/35d9a31b-2b5d-4cbb-9763-299cacc76128/code.php new file mode 100644 index 0000000..038c77f --- /dev/null +++ b/src/35d9a31b-2b5d-4cbb-9763-299cacc76128/code.php @@ -0,0 +1,71 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Fieldtype\Readme; + + +use VDM\Joomla\Interfaces\Readme\ItemInterface; + + +/** + * Compiler Field Type Item Readme + * + * @since 5.0.3 + */ +final class Item implements ItemInterface +{ + /** + * Get an item readme + * + * @param object $item An item details. + * + * @return string + * @since 3.2.2 + */ + public function get(object $item): string + { + // build readme + $readme = ["``` + ██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗ ███████╗██╗███████╗██╗ ██████╗ ████████╗██╗ ██╗██████╗ ███████╗ + ██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗ ██╔════╝██║██╔════╝██║ ██╔══██╗ ╚══██╔══╝╚██╗ ██╔╝██╔══██╗██╔════╝ + ██║██║ ██║██║ ██║██╔████╔██║██║ ███████║ █████╗ ██║█████╗ ██║ ██║ ██║ ██║ ╚████╔╝ ██████╔╝█████╗ +██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║ ██╔══╝ ██║██╔══╝ ██║ ██║ ██║ ██║ ╚██╔╝ ██╔═══╝ ██╔══╝ +╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║ ██║ ██║███████╗███████╗██████╔╝ ██║ ██║ ██║ ███████╗ + ╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ +```"]; + // system name + $readme[] = "# " . $item->name; + + if (!empty($item->description)) + { + $readme[] = "\n" . $item->description; + } + elseif (!empty($item->short_description)) + { + $readme[] = "\n" . $item->short_description; + } + + $readme[] = "\nThe Joomla! field types within this repository provide an essential mechanism for integrating Joomla-related field type into the Joomla Component Builder (JCB). Each field type is meticulously designed to ensure compatibility and ease of use within the JCB framework, allowing developers to effortlessly incorporate and manage custom fields in their components. By utilizing the reset functionality, users can seamlessly update individual field types to align with the latest versions maintained in our core repository, ensuring that their projects benefit from the most up-to-date features and fixes. Additionally, for those who prefer a more personalized approach, the repository can be forked, enabling developers to maintain and distribute their customized field types independently from the broader JCB community. This level of flexibility underscores the open-source nature of JCB, offering you the freedom to adapt and extend your components according to your specific needs, while still benefiting from a robust, community-driven ecosystem."; + + // yes you can remove this, but why? + $readme[] = "\n---\n``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +```\n> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)\n\n"; + + return implode("\n", $readme); + } +} + diff --git a/src/35d9a31b-2b5d-4cbb-9763-299cacc76128/code.power b/src/35d9a31b-2b5d-4cbb-9763-299cacc76128/code.power new file mode 100644 index 0000000..67be03a --- /dev/null +++ b/src/35d9a31b-2b5d-4cbb-9763-299cacc76128/code.power @@ -0,0 +1,45 @@ + /** + * Get an item readme + * + * @param object $item An item details. + * + * @return string + * @since 3.2.2 + */ + public function get(object $item): string + { + // build readme + $readme = ["``` + ██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗ ███████╗██╗███████╗██╗ ██████╗ ████████╗██╗ ██╗██████╗ ███████╗ + ██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗ ██╔════╝██║██╔════╝██║ ██╔══██╗ ╚══██╔══╝╚██╗ ██╔╝██╔══██╗██╔════╝ + ██║██║ ██║██║ ██║██╔████╔██║██║ ███████║ █████╗ ██║█████╗ ██║ ██║ ██║ ██║ ╚████╔╝ ██████╔╝█████╗ +██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║ ██╔══╝ ██║██╔══╝ ██║ ██║ ██║ ██║ ╚██╔╝ ██╔═══╝ ██╔══╝ +╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║ ██║ ██║███████╗███████╗██████╔╝ ██║ ██║ ██║ ███████╗ + ╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ +```"]; + // system name + $readme[] = "# " . $item->name; + + if (!empty($item->description)) + { + $readme[] = "\n" . $item->description; + } + elseif (!empty($item->short_description)) + { + $readme[] = "\n" . $item->short_description; + } + + $readme[] = "\nThe Joomla! field types within this repository provide an essential mechanism for integrating Joomla-related field type into the Joomla Component Builder (JCB). Each field type is meticulously designed to ensure compatibility and ease of use within the JCB framework, allowing developers to effortlessly incorporate and manage custom fields in their components. By utilizing the reset functionality, users can seamlessly update individual field types to align with the latest versions maintained in our core repository, ensuring that their projects benefit from the most up-to-date features and fixes. Additionally, for those who prefer a more personalized approach, the repository can be forked, enabling developers to maintain and distribute their customized field types independently from the broader JCB community. This level of flexibility underscores the open-source nature of JCB, offering you the freedom to adapt and extend your components according to your specific needs, while still benefiting from a robust, community-driven ecosystem."; + + // yes you can remove this, but why? + $readme[] = "\n---\n``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +```\n> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)\n\n"; + + return implode("\n", $readme); + } \ No newline at end of file diff --git a/src/35d9a31b-2b5d-4cbb-9763-299cacc76128/settings.json b/src/35d9a31b-2b5d-4cbb-9763-299cacc76128/settings.json new file mode 100644 index 0000000..faa8777 --- /dev/null +++ b/src/35d9a31b-2b5d-4cbb-9763-299cacc76128/settings.json @@ -0,0 +1,21 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "", + "guid": "35d9a31b-2b5d-4cbb-9763-299cacc76128", + "implements": [ + "65a0f81a-14fc-4870-9382-b8d830b19937" + ], + "load_selection": null, + "name": "Item", + "power_version": "1.0.0", + "system_name": "JCB.Fieldtype.Readme.Item", + "type": "final class", + "use_selection": null, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Fieldtype.Readme.Item", + "description": "Compiler Field Type Item Readme\r\n\r\n@since 5.0.3", + "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/469608a8-72ba-4bad-8233-80a4127c72a8/README.md b/src/469608a8-72ba-4bad-8233-80a4127c72a8/README.md new file mode 100644 index 0000000..ac616d0 --- /dev/null +++ b/src/469608a8-72ba-4bad-8233-80a4127c72a8/README.md @@ -0,0 +1,53 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# abstract class Factory (Details) +> namespace: **VDM\Joomla\Componentbuilder\Fieldtype** +> extends: **ExtendingFactory** + +```uml +@startuml +abstract Factory #Orange { + # {static} createContainer() : Container +} + +note right of Factory::createContainer + Create a container object + + since: 5.0.3 + return: Container +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---469608a8_72ba_4bad_8233_80a4127c72a8---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.php b/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.php new file mode 100644 index 0000000..249140f --- /dev/null +++ b/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.php @@ -0,0 +1,52 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Fieldtype; + + +use Joomla\DI\Container; +use VDM\Joomla\Componentbuilder\Fieldtype\Service\Fieldtype as Power; +use VDM\Joomla\Service\Database; +use VDM\Joomla\Service\Model; +use VDM\Joomla\Service\Data; +use VDM\Joomla\Componentbuilder\Service\Gitea; +use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower; +use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities; +use VDM\Joomla\Interfaces\FactoryInterface; +use VDM\Joomla\Abstraction\Factory as ExtendingFactory; + + +/** + * Field Type Power Factory + * + * @since 5.0.3 + */ +abstract class Factory extends ExtendingFactory implements FactoryInterface +{ + /** + * Create a container object + * + * @return Container + * @since 5.0.3 + */ + protected static function createContainer(): Container + { + return (new Container()) + ->registerServiceProvider(new Power()) + ->registerServiceProvider(new Database()) + ->registerServiceProvider(new Model()) + ->registerServiceProvider(new Data()) + ->registerServiceProvider(new Gitea()) + ->registerServiceProvider(new GiteaPower()) + ->registerServiceProvider(new GiteaUtilities()); + } +} + diff --git a/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.power b/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.power new file mode 100644 index 0000000..b009118 --- /dev/null +++ b/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.power @@ -0,0 +1,17 @@ + /** + * Create a container object + * + * @return Container + * @since 5.0.3 + */ + protected static function createContainer(): Container + { + return (new Container()) + ->registerServiceProvider(new Power()) + ->registerServiceProvider(new Database()) + ->registerServiceProvider(new Model()) + ->registerServiceProvider(new Data()) + ->registerServiceProvider(new Gitea()) + ->registerServiceProvider(new GiteaPower()) + ->registerServiceProvider(new GiteaUtilities()); + } \ No newline at end of file diff --git a/src/469608a8-72ba-4bad-8233-80a4127c72a8/settings.json b/src/469608a8-72ba-4bad-8233-80a4127c72a8/settings.json new file mode 100644 index 0000000..e0ef279 --- /dev/null +++ b/src/469608a8-72ba-4bad-8233-80a4127c72a8/settings.json @@ -0,0 +1,50 @@ +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "2e5bf608-de5c-4b00-a20d-47c26aa350d9", + "guid": "469608a8-72ba-4bad-8233-80a4127c72a8", + "implements": [ + "caf33c5d-858c-4f9a-894f-ab302ec5445a" + ], + "load_selection": null, + "name": "Factory", + "power_version": "1.0.0", + "system_name": "JCB.Fieldtype.Factory", + "type": "abstract class", + "use_selection": { + "use_selection0": { + "use": "4adfb171-2580-4d57-8fbb-fb92cfd11046", + "as": "Power" + }, + "use_selection1": { + "use": "4815e1c7-a433-443d-a112-d1e03d7df84b", + "as": "default" + }, + "use_selection2": { + "use": "2dcedd6c-c95b-4a37-9cac-95d28faedca3", + "as": "default" + }, + "use_selection3": { + "use": "a5daf189-3345-4b13-8716-c51f686f545b", + "as": "default" + }, + "use_selection4": { + "use": "71acf8d6-32b8-4173-8277-eb9cda29fd64", + "as": "default" + }, + "use_selection5": { + "use": "510dc0f6-da3f-4a78-b43d-3a03e2cb5fae", + "as": "GiteaPower" + }, + "use_selection6": { + "use": "6edf0cf3-c2b0-45c9-84d2-c6ef1c5d434c", + "as": "GiteaUtilities" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Fieldtype.Factory", + "description": "Field Type Power Factory\r\n\r\n@since 5.0.3", + "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/4adfb171-2580-4d57-8fbb-fb92cfd11046/README.md b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/README.md new file mode 100644 index 0000000..378c33b --- /dev/null +++ b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/README.md @@ -0,0 +1,108 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# class Fieldtype (Details) +> namespace: **VDM\Joomla\Componentbuilder\Fieldtype\Service** + +```uml +@startuml +class Fieldtype #Gold { + + register(Container $container) : void + + getConfig(Container $container) : Config + + getTable(Container $container) : Table + + getGrep(Container $container) : Grep + + getRemoteGet(Container $container) : Get + + getRemoteSet(Container $container) : Set + + getItemReadme(Container $container) : ItemReadme + + getMainReadme(Container $container) : MainReadme +} + +note right of Fieldtype::register + Registers the service provider with a DI container. + + since: 3.2.1 + return: void +end note + +note left of Fieldtype::getConfig + Get The Config Class. + + since: 3.2.1 + return: Config +end note + +note right of Fieldtype::getTable + Get The Table Class. + + since: 3.2.1 + return: Table +end note + +note left of Fieldtype::getGrep + Get The Grep Class. + + since: 3.2.1 + return: Grep +end note + +note right of Fieldtype::getRemoteGet + Get The Remote Get Class. + + since: 3.2.1 + return: Get +end note + +note left of Fieldtype::getRemoteSet + Get The Remote Set Class. + + since: 3.2.2 + return: Set +end note + +note right of Fieldtype::getItemReadme + Get The Item Class. + + since: 3.2.1 + return: ItemReadme +end note + +note left of Fieldtype::getMainReadme + Get The Main Class. + + since: 3.2.1 + return: MainReadme +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---4adfb171_2580_4d57_8fbb_fb92cfd11046---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.php b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.php new file mode 100644 index 0000000..669f522 --- /dev/null +++ b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.php @@ -0,0 +1,169 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Fieldtype\Service; + + +use Joomla\DI\Container; +use Joomla\DI\ServiceProviderInterface; +use VDM\Joomla\Componentbuilder\Fieldtype\Config; +use VDM\Joomla\Componentbuilder\Table; +use VDM\Joomla\Componentbuilder\Fieldtype\Grep; +use VDM\Joomla\Componentbuilder\Fieldtype\Remote\Get; +use VDM\Joomla\Componentbuilder\Fieldtype\Remote\Set; +use VDM\Joomla\Componentbuilder\Fieldtype\Readme\Item as ItemReadme; +use VDM\Joomla\Componentbuilder\Fieldtype\Readme\Main as MainReadme; + + +/** + * Field Type Service Provider + * + * @since 5.0.3 + */ +class Fieldtype implements ServiceProviderInterface +{ + /** + * Registers the service provider with a DI container. + * + * @param Container $container The DI container. + * + * @return void + * @since 3.2.1 + */ + public function register(Container $container) + { + $container->alias(Config::class, 'Config') + ->share('Config', [$this, 'getConfig'], true); + + $container->alias(Table::class, 'Table') + ->share('Table', [$this, 'getTable'], true); + + $container->alias(Grep::class, 'Joomla.Fieldtype.Grep') + ->share('Joomla.Fieldtype.Grep', [$this, 'getGrep'], true); + + $container->alias(Get::class, 'Joomla.Fieldtype.Remote.Get') + ->share('Joomla.Fieldtype.Remote.Get', [$this, 'getRemoteGet'], true); + + $container->alias(Set::class, 'Joomla.Fieldtype.Remote.Set') + ->share('Joomla.Fieldtype.Remote.Set', [$this, 'getRemoteSet'], true); + + $container->alias(ItemReadme::class, 'Joomla.Fieldtype.Readme.Item') + ->share('Joomla.Fieldtype.Readme.Item', [$this, 'getItemReadme'], true); + + $container->alias(MainReadme::class, 'Joomla.Fieldtype.Readme.Main') + ->share('Joomla.Fieldtype.Readme.Main', [$this, 'getMainReadme'], true); + } + + /** + * Get The Config Class. + * + * @param Container $container The DI container. + * + * @return Config + * @since 3.2.1 + */ + public function getConfig(Container $container): Config + { + return new Config(); + } + + /** + * Get The Table Class. + * + * @param Container $container The DI container. + * + * @return Table + * @since 3.2.1 + */ + public function getTable(Container $container): Table + { + return new Table(); + } + + /** + * Get The Grep Class. + * + * @param Container $container The DI container. + * + * @return Grep + * @since 3.2.1 + */ + public function getGrep(Container $container): Grep + { + return new Grep( + $container->get('Gitea.Repository.Contents'), + $container->get('Config')->approved_joomla_paths + ); + } + + /** + * Get The Remote Get Class. + * + * @param Container $container The DI container. + * + * @return Get + * @since 3.2.1 + */ + public function getRemoteGet(Container $container): Get + { + return new Get( + $container->get('Joomla.Fieldtype.Grep'), + $container->get('Data.Item') + ); + } + + /** + * Get The Remote Set Class. + * + * @param Container $container The DI container. + * + * @return Set + * @since 3.2.2 + */ + public function getRemoteSet(Container $container): Set + { + return new Set( + $container->get('Config')->approved_joomla_paths, + $container->get('Joomla.Fieldtype.Grep'), + $container->get('Data.Items'), + $container->get('Joomla.Fieldtype.Readme.Item'), + $container->get('Joomla.Fieldtype.Readme.Main'), + $container->get('Gitea.Repository.Contents') + ); + } + + /** + * Get The Item Class. + * + * @param Container $container The DI container. + * + * @return ItemReadme + * @since 3.2.1 + */ + public function getItemReadme(Container $container): ItemReadme + { + return new ItemReadme(); + } + + /** + * Get The Main Class. + * + * @param Container $container The DI container. + * + * @return MainReadme + * @since 3.2.1 + */ + public function getMainReadme(Container $container): MainReadme + { + return new MainReadme(); + } +} + diff --git a/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.power b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.power new file mode 100644 index 0000000..c5d644a --- /dev/null +++ b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.power @@ -0,0 +1,135 @@ + /** + * Registers the service provider with a DI container. + * + * @param Container $container The DI container. + * + * @return void + * @since 3.2.1 + */ + public function register(Container $container) + { + $container->alias(Config::class, 'Config') + ->share('Config', [$this, 'getConfig'], true); + + $container->alias(Table::class, 'Table') + ->share('Table', [$this, 'getTable'], true); + + $container->alias(Grep::class, 'Joomla.Fieldtype.Grep') + ->share('Joomla.Fieldtype.Grep', [$this, 'getGrep'], true); + + $container->alias(Get::class, 'Joomla.Fieldtype.Remote.Get') + ->share('Joomla.Fieldtype.Remote.Get', [$this, 'getRemoteGet'], true); + + $container->alias(Set::class, 'Joomla.Fieldtype.Remote.Set') + ->share('Joomla.Fieldtype.Remote.Set', [$this, 'getRemoteSet'], true); + + $container->alias(ItemReadme::class, 'Joomla.Fieldtype.Readme.Item') + ->share('Joomla.Fieldtype.Readme.Item', [$this, 'getItemReadme'], true); + + $container->alias(MainReadme::class, 'Joomla.Fieldtype.Readme.Main') + ->share('Joomla.Fieldtype.Readme.Main', [$this, 'getMainReadme'], true); + } + + /** + * Get The Config Class. + * + * @param Container $container The DI container. + * + * @return Config + * @since 3.2.1 + */ + public function getConfig(Container $container): Config + { + return new Config(); + } + + /** + * Get The Table Class. + * + * @param Container $container The DI container. + * + * @return Table + * @since 3.2.1 + */ + public function getTable(Container $container): Table + { + return new Table(); + } + + /** + * Get The Grep Class. + * + * @param Container $container The DI container. + * + * @return Grep + * @since 3.2.1 + */ + public function getGrep(Container $container): Grep + { + return new Grep( + $container->get('Gitea.Repository.Contents'), + $container->get('Config')->approved_joomla_paths + ); + } + + /** + * Get The Remote Get Class. + * + * @param Container $container The DI container. + * + * @return Get + * @since 3.2.1 + */ + public function getRemoteGet(Container $container): Get + { + return new Get( + $container->get('Joomla.Fieldtype.Grep'), + $container->get('Data.Item') + ); + } + + /** + * Get The Remote Set Class. + * + * @param Container $container The DI container. + * + * @return Set + * @since 3.2.2 + */ + public function getRemoteSet(Container $container): Set + { + return new Set( + $container->get('Config')->approved_joomla_paths, + $container->get('Joomla.Fieldtype.Grep'), + $container->get('Data.Items'), + $container->get('Joomla.Fieldtype.Readme.Item'), + $container->get('Joomla.Fieldtype.Readme.Main'), + $container->get('Gitea.Repository.Contents') + ); + } + + /** + * Get The Item Class. + * + * @param Container $container The DI container. + * + * @return ItemReadme + * @since 3.2.1 + */ + public function getItemReadme(Container $container): ItemReadme + { + return new ItemReadme(); + } + + /** + * Get The Main Class. + * + * @param Container $container The DI container. + * + * @return MainReadme + * @since 3.2.1 + */ + public function getMainReadme(Container $container): MainReadme + { + return new MainReadme(); + } \ No newline at end of file diff --git a/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/settings.json b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/settings.json new file mode 100644 index 0000000..ad902e6 --- /dev/null +++ b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/settings.json @@ -0,0 +1,51 @@ +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "", + "guid": "4adfb171-2580-4d57-8fbb-fb92cfd11046", + "implements": [ + "-1" + ], + "load_selection": null, + "name": "Fieldtype", + "power_version": "1.0.0", + "system_name": "JCB.Fieldtype.Service.Fieldtype", + "type": "class", + "use_selection": { + "use_selection0": { + "use": "baf83354-0be5-410e-80f9-2b64b052e482", + "as": "default" + }, + "use_selection1": { + "use": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8", + "as": "default" + }, + "use_selection2": { + "use": "d8d35836-60f2-4464-a306-097f079c4f13", + "as": "default" + }, + "use_selection3": { + "use": "3235d233-ba17-4a4a-9078-aeb8c8716c04", + "as": "default" + }, + "use_selection4": { + "use": "d45b9f58-e4d7-4b0a-be05-e34c6fa215c8", + "as": "default" + }, + "use_selection5": { + "use": "35d9a31b-2b5d-4cbb-9763-299cacc76128", + "as": "ItemReadme" + }, + "use_selection6": { + "use": "927fc3eb-9332-43ec-b903-ce16dcf6df09", + "as": "MainReadme" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Fieldtype.Service.Fieldtype", + "description": "Field Type Service Provider\r\n\r\n@since 5.0.3", + "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/5247cc17-b620-4cf3-9a1e-d0589b36ab35/README.md b/src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/README.md new file mode 100644 index 0000000..c9ba69d --- /dev/null +++ b/src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/README.md @@ -0,0 +1,55 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# interface CreateUserInterface (Details) +> namespace: **VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass** + +```uml +@startuml +interface CreateUserInterface #Lavender { + + get($add) : string +} + +note right of CreateUserInterface::get + Generates the method definition for creating or updating a user based on the provided parameters. +This method returns a string representation of a PHP function that includes various +steps for handling user creation and updates, depending on the mode (site registration or admin registration). +If true, the method will be generated and returned as a string. +Returns an empty string if $add is false. + + return: string +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---5247cc17_b620_4cf3_9a1e_d0589b36ab35---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/code.php b/src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/code.php new file mode 100644 index 0000000..26171ef --- /dev/null +++ b/src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/code.php @@ -0,0 +1,36 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass; + + +/** + * Component Helper Class Create User Interface + * + * @since 5.0.2 + */ +interface CreateUserInterface +{ + /** + * Generates the method definition for creating or updating a user based on the provided parameters. + * + * This method returns a string representation of a PHP function that includes various + * steps for handling user creation and updates, depending on the mode (site registration or admin registration). + * + * @param $add Determines whether to generate the user creation method or not. + * If true, the method will be generated and returned as a string. + * + * @return string The generated method code as a string if $add is true. + * Returns an empty string if $add is false. + */ + public function get($add): string; +} + diff --git a/src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/code.power b/src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/code.power new file mode 100644 index 0000000..4da1e9f --- /dev/null +++ b/src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/code.power @@ -0,0 +1,13 @@ + /** + * Generates the method definition for creating or updating a user based on the provided parameters. + * + * This method returns a string representation of a PHP function that includes various + * steps for handling user creation and updates, depending on the mode (site registration or admin registration). + * + * @param $add Determines whether to generate the user creation method or not. + * If true, the method will be generated and returned as a string. + * + * @return string The generated method code as a string if $add is true. + * Returns an empty string if $add is false. + */ + public function get($add): string; \ No newline at end of file diff --git a/src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/settings.json b/src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/settings.json new file mode 100644 index 0000000..72d0c62 --- /dev/null +++ b/src/5247cc17-b620-4cf3-9a1e-d0589b36ab35/settings.json @@ -0,0 +1,19 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "", + "guid": "5247cc17-b620-4cf3-9a1e-d0589b36ab35", + "implements": null, + "load_selection": null, + "name": "CreateUserInterface", + "power_version": "1.0.0", + "system_name": "JCB.Interfaces.Architecture.ComHelperC.CreateUser", + "type": "interface", + "use_selection": null, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Compiler.Interfaces.Architecture.ComHelperClass.CreateUserInterface", + "description": "Component Helper Class Create User Interface\r\n\r\n@since 5.0.2", + "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/55278140-80d5-4168-8241-d64515c4b35e/code.php b/src/55278140-80d5-4168-8241-d64515c4b35e/code.php index ada8df7..ec5b422 100644 --- a/src/55278140-80d5-4168-8241-d64515c4b35e/code.php +++ b/src/55278140-80d5-4168-8241-d64515c4b35e/code.php @@ -992,7 +992,8 @@ final class Builders 'code' => $name, 'name' => $listLangName, 'extension' => $_extension, - 'filter' => $field['filter'] + 'filter' => $field['filter'], + 'add_icon' => StringHelper::check($view['settings']->icon_category) ]); // also set code name for title alias fix $this->categorycode->set($nameSingleCode, [ @@ -1116,7 +1117,7 @@ final class Builders break; } // just a heads-up for usergroups set to multiple - if ($typeName === 'usergroup') + if ($typeName === 'usergroup' || $typeName === 'usergrouplist') { $this->sitefielddata->set( $nameSingleCode, $name, 'json', $typeName diff --git a/src/55278140-80d5-4168-8241-d64515c4b35e/code.power b/src/55278140-80d5-4168-8241-d64515c4b35e/code.power index f4c2c39..0f18c2a 100644 --- a/src/55278140-80d5-4168-8241-d64515c4b35e/code.power +++ b/src/55278140-80d5-4168-8241-d64515c4b35e/code.power @@ -915,7 +915,8 @@ 'code' => $name, 'name' => $listLangName, 'extension' => $_extension, - 'filter' => $field['filter'] + 'filter' => $field['filter'], + 'add_icon' => StringHelper::check($view['settings']->icon_category) ]); // also set code name for title alias fix $this->categorycode->set($nameSingleCode, [ @@ -1039,7 +1040,7 @@ break; } // just a heads-up for usergroups set to multiple - if ($typeName === 'usergroup') + if ($typeName === 'usergroup' || $typeName === 'usergrouplist') { $this->sitefielddata->set( $nameSingleCode, $name, 'json', $typeName diff --git a/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/README.md b/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/README.md new file mode 100644 index 0000000..8368c2c --- /dev/null +++ b/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/README.md @@ -0,0 +1,55 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class CreateUser (Details) +> namespace: **VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\ComHelperClass** + +```uml +@startuml +class CreateUser << (F,LightGreen) >> #RoyalBlue { + + get($add) : string +} + +note right of CreateUser::get + Generates the method definition for creating or updating a user based on the provided parameters. +This method returns a string representation of a PHP function that includes various +steps for handling user creation and updates, depending on the mode (site registration or admin registration). +If true, the method will be generated and returned as a string. +Returns an empty string if $add is false. + + return: string +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---8c7abe76_516e_4c4f_97c1_244ca43b7726---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/code.php b/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/code.php new file mode 100644 index 0000000..f60ca27 --- /dev/null +++ b/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/code.php @@ -0,0 +1,366 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\ComHelperClass; + + +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface; + + +/** + * Helper Class Create User Class for Joomla 3 + * + * @since 5.0.2 + */ +final class CreateUser implements CreateUserInterface +{ + /** + * Generates the method definition for creating or updating a user based on the provided parameters. + * + * This method returns a string representation of a PHP function that includes various + * steps for handling user creation and updates, depending on the mode (site registration or admin registration). + * + * @param $add Determines whether to generate the user creation method or not. + * If true, the method will be generated and returned as a string. + * + * @return string The generated method code as a string if $add is true. + * Returns an empty string if $add is false. + */ + public function get($add): string + { + if ($add) + { + $method = []; + $method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Greate user and update given table"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) + . " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)"; + $method[] = Indent::_(1) . " * @param int \$autologin"; + $method[] = Indent::_(1) + . " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)"; + $method[] = Indent::_(1) + . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) + . " * @return int|Error User ID on success, or an error."; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function createUser(\$credentials, \$autologin = 0,"; + $method[] = Indent::_(2) . "\$params = array("; + $method[] = Indent::_(3) + . "'useractivation' => 0, 'sendpassword' => 1"; + $method[] = Indent::_(2) . "), \$mode = 1"; + $method[] = Indent::_(1) . ")"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Override mode"; + $method[] = Indent::_(2) + . "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Update params"; + $method[] = Indent::_(3) . "\$params['autologin'] = \$autologin;"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Now Register User"; + $method[] = Indent::_(3) + . "return self::registerUser(\$credentials, \$params);"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "elseif (\$mode == 2)"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Fallback to Site Registrations"; + $method[] = Indent::_(3) . "\$mode = 1;"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " load the user component language files if there is an error."; + $method[] = Indent::_(2) . "\$lang = Factory::getLanguage();"; + $method[] = Indent::_(2) . "\$extension = 'com_users';"; + $method[] = Indent::_(2) . "\$base_dir = JPATH_SITE;"; + $method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB') + . "';"; + $method[] = Indent::_(2) . "\$reload = true;"; + $method[] = Indent::_(2) + . "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Load the correct user model."; + $method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_( + __LINE__,__CLASS__ + ) + . " 1 = Site Registrations"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Load the user site-registration model"; + $method[] = Indent::_(3) + . "\$model = self::getModel('registration', \$base_dir . '/components/' . \$extension, 'Users');"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__) + . " 0 = Admin Registration"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Load the backend-user model"; + $method[] = Indent::_(3) + . "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/' . \$extension, 'Users');"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Check if we have params/config"; + $method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Make changes to user config"; + $method[] = Indent::_(3) + . "foreach (\$params as \$param => \$set)"; + $method[] = Indent::_(3) . "{"; + $method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " If you know of a better path, let me know"; + $method[] = Indent::_(4) + . "\$params[\$param] = self::setParams(\$extension, \$param, \$set);"; + $method[] = Indent::_(3) . "}"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Set username to email if not set"; + $method[] = Indent::_(2) + . "if (!isset(\$credentials['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['username']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) + . "\$credentials['username'] = \$credentials['email'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Lineup new user data array"; + $method[] = Indent::_(2) . "\$data = array("; + $method[] = Indent::_(3) + . "'username' => \$credentials['username'],"; + $method[] = Indent::_(3) . "'name' => \$credentials['name'],"; + $method[] = Indent::_(3) . "'block' => 0 );"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Added details based on mode"; + $method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_( + __LINE__,__CLASS__ + ) + . " 1 = Site-registration mode"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) + . "\$data['email1'] = \$credentials['email'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__) + . " 0 = Admin-registration mode"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) + . "\$data['email'] = \$credentials['email'];"; + $method[] = Indent::_(3) + . "\$data['registerDate'] = Factory::getDate()->toSql();"; + $method[] = Indent::_(2) . "}"; + + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Check if password was set"; + $method[] = Indent::_(2) + . "if (\$mode == 1 && (!isset(\$credentials['password']) || !isset(\$credentials['password2']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2'])))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Set random password when empty password was submitted,"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " when using the 1 = site-registration mode"; + $method[] = Indent::_(3) + . "\$credentials['password'] = self::randomkey(8);"; + $method[] = Indent::_(3) + . "\$credentials['password2'] = \$credentials['password'];"; + $method[] = Indent::_(2) . "}"; + + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Now Add password if set"; + $method[] = Indent::_(2) + . "if (isset(\$credentials['password']) && isset(\$credentials['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "if (\$mode == 1) //" . Line::_( + __LINE__,__CLASS__ + ) + . " 1 = Site-registration mode"; + $method[] = Indent::_(3) . "{"; + $method[] = Indent::_(4) + . "\$data['password1'] = \$credentials['password'];"; + $method[] = Indent::_(3) . "}"; + $method[] = Indent::_(3) . "else //" . Line::_(__Line__, __Class__) + . " 0 = Admin-registration mode"; + $method[] = Indent::_(3) . "{"; + $method[] = Indent::_(4) + . "\$data['password'] = \$credentials['password'];"; + $method[] = Indent::_(3) . "}"; + $method[] = Indent::_(3) + . "\$data['password2'] = \$credentials['password2'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Load the group/s value if set, only for Admin Registration (\$mode == 0)"; + $method[] = Indent::_(2) + . "if (\$mode == 0 && isset(\$credentials['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$credentials['groups']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) + . "\$data['groups'] = \$credentials['groups'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Create the new user"; + $method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_( + __LINE__,__CLASS__ + ) + . " 1 = Site-registration mode"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "\$userId = \$model->register(\$data);"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__) + . " 0 = Admin-registration mode"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "\$model->save(\$data);"; + $method[] = Indent::_(3) + . "\$userId = \$model->getState('user.id', 0);"; + $method[] = Indent::_(2) . "}"; + + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Check if we have params"; + $method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Change user params/config back"; + $method[] = Indent::_(3) + . "foreach (\$params as \$param => \$set)"; + $method[] = Indent::_(3) . "{"; + $method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " If you know of a better path, let me know"; + $method[] = Indent::_(4) + . "self::setParams(\$extension, \$param, \$set);"; + $method[] = Indent::_(3) . "}"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " if user is created"; + $method[] = Indent::_(2) . "if (\$userId > 0)"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Auto Login if Needed"; + $method[] = Indent::_(3) + . "if (\$autologin && isset(\$credentials['password']))"; + $method[] = Indent::_(3) . "{"; + $method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " Try to login"; + $method[] = Indent::_(4) . "try{"; + $method[] = Indent::_(5) + . "Factory::getApplication()->login(\$credentials);"; + $method[] = Indent::_(4) . "} catch (\Exception \$exception){"; + $method[] = Indent::_(5) . "//" . Line::_(__Line__, __Class__) + . " Do noting for now, may want to set redirect."; + $method[] = Indent::_(4) . "}"; + $method[] = Indent::_(3) . "}"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Return ID"; + $method[] = Indent::_(3) . "return \$userId;"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "return \$model->getError();"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . Indent::_(1) + . "public static function setParams(\$component,\$target,\$value)"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Get the params and set the new values"; + $method[] = Indent::_(2) + . "\$params = ComponentHelper::getParams(\$component);"; + $method[] = Indent::_(2) . "\$was = \$params->get(\$target, null);"; + $method[] = Indent::_(2) . "if (\$was != \$value)"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "\$params->set(\$target, \$value);"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Get a new database query instance"; + $method[] = Indent::_(3) . "\$db = Factory::getDBO();"; + $method[] = Indent::_(3) . "\$query = \$db->getQuery(true);"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Build the query"; + $method[] = Indent::_(3) . "\$query->update('#__extensions AS a');"; + $method[] = Indent::_(3) + . "\$query->set('a.params = ' . \$db->quote((string)\$params));"; + $method[] = Indent::_(3) + . "\$query->where('a.element = ' . \$db->quote((string)\$component));"; + $method[] = Indent::_(3); + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Execute the query"; + $method[] = Indent::_(3) . "\$db->setQuery(\$query);"; + $method[] = Indent::_(3) . "\$db->execute();"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "return \$was;"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Update user values"; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function updateUser(\$new)"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) + . "// load the user component language files if there is an error."; + $method[] = Indent::_(2) . "\$lang = Factory::getLanguage();"; + $method[] = Indent::_(2) . "\$extension = 'com_users';"; + $method[] = Indent::_(2) . "\$base_dir = JPATH_ADMINISTRATOR;"; + $method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB') + . "';"; + $method[] = Indent::_(2) . "\$reload = true;"; + $method[] = Indent::_(2) + . "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);"; + $method[] = Indent::_(2) . "// load the user model"; + $method[] = Indent::_(2) + . "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/com_users', 'Users');"; + $method[] = Indent::_(2) . "// Check if password was set"; + $method[] = Indent::_(2) + . "if (isset(\$new['password']) && isset(\$new['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password2']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "// Use the users passwords"; + $method[] = Indent::_(3) . "\$password = \$new['password'];"; + $method[] = Indent::_(3) . "\$password2 = \$new['password2'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "// set username"; + $method[] = Indent::_(2) + . "if (!isset(\$new['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['username']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) + . "\$new['username'] = \$new['email'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "// lineup update user data"; + $method[] = Indent::_(2) . "\$data = array("; + $method[] = Indent::_(3) . "'id' => \$new['id'],"; + $method[] = Indent::_(3) . "'username' => \$new['username'],"; + $method[] = Indent::_(3) . "'name' => \$new['name'],"; + $method[] = Indent::_(3) . "'email' => \$new['email'],"; + $method[] = Indent::_(3) + . "'password' => \$password, // First password field"; + $method[] = Indent::_(3) + . "'password2' => \$password2, // Confirm password field"; + $method[] = Indent::_(3) . "'block' => 0 );"; + $method[] = Indent::_(2) . "// set groups if found"; + $method[] = Indent::_(2) + . "if (isset(\$new['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$new['groups']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "\$data['groups'] = \$new['groups'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "// register the new user"; + $method[] = Indent::_(2) . "\$done = \$model->save(\$data);"; + $method[] = Indent::_(2) . "// if user is updated"; + $method[] = Indent::_(2) . "if (\$done)"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "return \$new['id'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "return \$model->getError();"; + $method[] = Indent::_(1) . "}"; + + // return the help method + return implode(PHP_EOL, $method); + } + + return ''; + } +} + diff --git a/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/code.power b/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/code.power new file mode 100644 index 0000000..cc47b92 --- /dev/null +++ b/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/code.power @@ -0,0 +1,338 @@ + /** + * Generates the method definition for creating or updating a user based on the provided parameters. + * + * This method returns a string representation of a PHP function that includes various + * steps for handling user creation and updates, depending on the mode (site registration or admin registration). + * + * @param $add Determines whether to generate the user creation method or not. + * If true, the method will be generated and returned as a string. + * + * @return string The generated method code as a string if $add is true. + * Returns an empty string if $add is false. + */ + public function get($add): string + { + if ($add) + { + $method = []; + $method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Greate user and update given table"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) + . " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)"; + $method[] = Indent::_(1) . " * @param int \$autologin"; + $method[] = Indent::_(1) + . " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)"; + $method[] = Indent::_(1) + . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) + . " * @return int|Error User ID on success, or an error."; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function createUser(\$credentials, \$autologin = 0,"; + $method[] = Indent::_(2) . "\$params = array("; + $method[] = Indent::_(3) + . "'useractivation' => 0, 'sendpassword' => 1"; + $method[] = Indent::_(2) . "), \$mode = 1"; + $method[] = Indent::_(1) . ")"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Override mode"; + $method[] = Indent::_(2) + . "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Update params"; + $method[] = Indent::_(3) . "\$params['autologin'] = \$autologin;"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Now Register User"; + $method[] = Indent::_(3) + . "return self::registerUser(\$credentials, \$params);"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "elseif (\$mode == 2)"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Fallback to Site Registrations"; + $method[] = Indent::_(3) . "\$mode = 1;"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " load the user component language files if there is an error."; + $method[] = Indent::_(2) . "\$lang = Factory::getLanguage();"; + $method[] = Indent::_(2) . "\$extension = 'com_users';"; + $method[] = Indent::_(2) . "\$base_dir = JPATH_SITE;"; + $method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB') + . "';"; + $method[] = Indent::_(2) . "\$reload = true;"; + $method[] = Indent::_(2) + . "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Load the correct user model."; + $method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_( + __LINE__,__CLASS__ + ) + . " 1 = Site Registrations"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Load the user site-registration model"; + $method[] = Indent::_(3) + . "\$model = self::getModel('registration', \$base_dir . '/components/' . \$extension, 'Users');"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__) + . " 0 = Admin Registration"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Load the backend-user model"; + $method[] = Indent::_(3) + . "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/' . \$extension, 'Users');"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Check if we have params/config"; + $method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Make changes to user config"; + $method[] = Indent::_(3) + . "foreach (\$params as \$param => \$set)"; + $method[] = Indent::_(3) . "{"; + $method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " If you know of a better path, let me know"; + $method[] = Indent::_(4) + . "\$params[\$param] = self::setParams(\$extension, \$param, \$set);"; + $method[] = Indent::_(3) . "}"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Set username to email if not set"; + $method[] = Indent::_(2) + . "if (!isset(\$credentials['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['username']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) + . "\$credentials['username'] = \$credentials['email'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Lineup new user data array"; + $method[] = Indent::_(2) . "\$data = array("; + $method[] = Indent::_(3) + . "'username' => \$credentials['username'],"; + $method[] = Indent::_(3) . "'name' => \$credentials['name'],"; + $method[] = Indent::_(3) . "'block' => 0 );"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Added details based on mode"; + $method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_( + __LINE__,__CLASS__ + ) + . " 1 = Site-registration mode"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) + . "\$data['email1'] = \$credentials['email'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__) + . " 0 = Admin-registration mode"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) + . "\$data['email'] = \$credentials['email'];"; + $method[] = Indent::_(3) + . "\$data['registerDate'] = Factory::getDate()->toSql();"; + $method[] = Indent::_(2) . "}"; + + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Check if password was set"; + $method[] = Indent::_(2) + . "if (\$mode == 1 && (!isset(\$credentials['password']) || !isset(\$credentials['password2']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2'])))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Set random password when empty password was submitted,"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " when using the 1 = site-registration mode"; + $method[] = Indent::_(3) + . "\$credentials['password'] = self::randomkey(8);"; + $method[] = Indent::_(3) + . "\$credentials['password2'] = \$credentials['password'];"; + $method[] = Indent::_(2) . "}"; + + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Now Add password if set"; + $method[] = Indent::_(2) + . "if (isset(\$credentials['password']) && isset(\$credentials['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "if (\$mode == 1) //" . Line::_( + __LINE__,__CLASS__ + ) + . " 1 = Site-registration mode"; + $method[] = Indent::_(3) . "{"; + $method[] = Indent::_(4) + . "\$data['password1'] = \$credentials['password'];"; + $method[] = Indent::_(3) . "}"; + $method[] = Indent::_(3) . "else //" . Line::_(__Line__, __Class__) + . " 0 = Admin-registration mode"; + $method[] = Indent::_(3) . "{"; + $method[] = Indent::_(4) + . "\$data['password'] = \$credentials['password'];"; + $method[] = Indent::_(3) . "}"; + $method[] = Indent::_(3) + . "\$data['password2'] = \$credentials['password2'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Load the group/s value if set, only for Admin Registration (\$mode == 0)"; + $method[] = Indent::_(2) + . "if (\$mode == 0 && isset(\$credentials['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$credentials['groups']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) + . "\$data['groups'] = \$credentials['groups'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Create the new user"; + $method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_( + __LINE__,__CLASS__ + ) + . " 1 = Site-registration mode"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "\$userId = \$model->register(\$data);"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__) + . " 0 = Admin-registration mode"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "\$model->save(\$data);"; + $method[] = Indent::_(3) + . "\$userId = \$model->getState('user.id', 0);"; + $method[] = Indent::_(2) . "}"; + + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Check if we have params"; + $method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Change user params/config back"; + $method[] = Indent::_(3) + . "foreach (\$params as \$param => \$set)"; + $method[] = Indent::_(3) . "{"; + $method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " If you know of a better path, let me know"; + $method[] = Indent::_(4) + . "self::setParams(\$extension, \$param, \$set);"; + $method[] = Indent::_(3) . "}"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " if user is created"; + $method[] = Indent::_(2) . "if (\$userId > 0)"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Auto Login if Needed"; + $method[] = Indent::_(3) + . "if (\$autologin && isset(\$credentials['password']))"; + $method[] = Indent::_(3) . "{"; + $method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) + . " Try to login"; + $method[] = Indent::_(4) . "try{"; + $method[] = Indent::_(5) + . "Factory::getApplication()->login(\$credentials);"; + $method[] = Indent::_(4) . "} catch (\Exception \$exception){"; + $method[] = Indent::_(5) . "//" . Line::_(__Line__, __Class__) + . " Do noting for now, may want to set redirect."; + $method[] = Indent::_(4) . "}"; + $method[] = Indent::_(3) . "}"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Return ID"; + $method[] = Indent::_(3) . "return \$userId;"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "return \$model->getError();"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . Indent::_(1) + . "public static function setParams(\$component,\$target,\$value)"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Get the params and set the new values"; + $method[] = Indent::_(2) + . "\$params = ComponentHelper::getParams(\$component);"; + $method[] = Indent::_(2) . "\$was = \$params->get(\$target, null);"; + $method[] = Indent::_(2) . "if (\$was != \$value)"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "\$params->set(\$target, \$value);"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Get a new database query instance"; + $method[] = Indent::_(3) . "\$db = Factory::getDBO();"; + $method[] = Indent::_(3) . "\$query = \$db->getQuery(true);"; + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Build the query"; + $method[] = Indent::_(3) . "\$query->update('#__extensions AS a');"; + $method[] = Indent::_(3) + . "\$query->set('a.params = ' . \$db->quote((string)\$params));"; + $method[] = Indent::_(3) + . "\$query->where('a.element = ' . \$db->quote((string)\$component));"; + $method[] = Indent::_(3); + $method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__) + . " Execute the query"; + $method[] = Indent::_(3) . "\$db->setQuery(\$query);"; + $method[] = Indent::_(3) . "\$db->execute();"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "return \$was;"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Update user values"; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function updateUser(\$new)"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) + . "// load the user component language files if there is an error."; + $method[] = Indent::_(2) . "\$lang = Factory::getLanguage();"; + $method[] = Indent::_(2) . "\$extension = 'com_users';"; + $method[] = Indent::_(2) . "\$base_dir = JPATH_ADMINISTRATOR;"; + $method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB') + . "';"; + $method[] = Indent::_(2) . "\$reload = true;"; + $method[] = Indent::_(2) + . "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);"; + $method[] = Indent::_(2) . "// load the user model"; + $method[] = Indent::_(2) + . "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/com_users', 'Users');"; + $method[] = Indent::_(2) . "// Check if password was set"; + $method[] = Indent::_(2) + . "if (isset(\$new['password']) && isset(\$new['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password2']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "// Use the users passwords"; + $method[] = Indent::_(3) . "\$password = \$new['password'];"; + $method[] = Indent::_(3) . "\$password2 = \$new['password2'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "// set username"; + $method[] = Indent::_(2) + . "if (!isset(\$new['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['username']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) + . "\$new['username'] = \$new['email'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "// lineup update user data"; + $method[] = Indent::_(2) . "\$data = array("; + $method[] = Indent::_(3) . "'id' => \$new['id'],"; + $method[] = Indent::_(3) . "'username' => \$new['username'],"; + $method[] = Indent::_(3) . "'name' => \$new['name'],"; + $method[] = Indent::_(3) . "'email' => \$new['email'],"; + $method[] = Indent::_(3) + . "'password' => \$password, // First password field"; + $method[] = Indent::_(3) + . "'password2' => \$password2, // Confirm password field"; + $method[] = Indent::_(3) . "'block' => 0 );"; + $method[] = Indent::_(2) . "// set groups if found"; + $method[] = Indent::_(2) + . "if (isset(\$new['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$new['groups']))"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "\$data['groups'] = \$new['groups'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "// register the new user"; + $method[] = Indent::_(2) . "\$done = \$model->save(\$data);"; + $method[] = Indent::_(2) . "// if user is updated"; + $method[] = Indent::_(2) . "if (\$done)"; + $method[] = Indent::_(2) . "{"; + $method[] = Indent::_(3) . "return \$new['id'];"; + $method[] = Indent::_(2) . "}"; + $method[] = Indent::_(2) . "return \$model->getError();"; + $method[] = Indent::_(1) . "}"; + + // return the help method + return implode(PHP_EOL, $method); + } + + return ''; + } \ No newline at end of file diff --git a/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/settings.json b/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/settings.json new file mode 100644 index 0000000..59e2e01 --- /dev/null +++ b/src/8c7abe76-516e-4c4f-97c1-244ca43b7726/settings.json @@ -0,0 +1,30 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "", + "guid": "8c7abe76-516e-4c4f-97c1-244ca43b7726", + "implements": [ + "5247cc17-b620-4cf3-9a1e-d0589b36ab35" + ], + "load_selection": null, + "name": "CreateUser", + "power_version": "1.0.0", + "system_name": "JCB.Architecture.J3.ComHelperClass.CreateUser", + "type": "final class", + "use_selection": { + "use_selection0": { + "use": "a68c010b-e92e-47d5-8a44-d23cfddeb6c6", + "as": "default" + }, + "use_selection1": { + "use": "4e6ff11d-bebf-42f5-8fd7-b2f882857222", + "as": "default" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Compiler.Architecture.JoomlaThree.ComHelperClass.CreateUser", + "description": "Helper Class Create User Class for Joomla 3\r\n\r\n@since 5.0.2", + "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/8cd3c4aa-8daf-4e40-a943-456f46112c7b/README.md b/src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/README.md new file mode 100644 index 0000000..eb97db3 --- /dev/null +++ b/src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/README.md @@ -0,0 +1,85 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# class ArchitectureComHelperClass (Details) +> namespace: **VDM\Joomla\Componentbuilder\Compiler\Service** + +```uml +@startuml +class ArchitectureComHelperClass #Gold { + # $targetVersion + + register(Container $container) : void + + getCreateUser(Container $container) : CreateUserInterface + + getJ5CreateUser(Container $container) : J5CreateUser + + getJ4CreateUser(Container $container) : J4CreateUser + + getJ3CreateUser(Container $container) : J3CreateUser +} + +note right of ArchitectureComHelperClass::register + Registers the service provider with a DI container. + + since: 5.0.2 + return: void +end note + +note right of ArchitectureComHelperClass::getCreateUser + Get The CreateUserInterface Class. + + since: 5.0.2 + return: CreateUserInterface +end note + +note right of ArchitectureComHelperClass::getJ5CreateUser + Get The CreateUser Class. + + since: 5.0.2 + return: J5CreateUser +end note + +note right of ArchitectureComHelperClass::getJ4CreateUser + Get The CreateUser Class. + + since: 5.0.2 + return: J4CreateUser +end note + +note right of ArchitectureComHelperClass::getJ3CreateUser + Get The CreateUser Class. + + since: 5.0.2 + return: J3CreateUser +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---8cd3c4aa_8daf_4e40_a943_456f46112c7b---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/code.php b/src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/code.php new file mode 100644 index 0000000..d11b7be --- /dev/null +++ b/src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/code.php @@ -0,0 +1,118 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Compiler\Service; + + +use Joomla\DI\Container; +use Joomla\DI\ServiceProviderInterface; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface; +use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\ComHelperClass\CreateUser as J5CreateUser; +use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\ComHelperClass\CreateUser as J4CreateUser; +use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\ComHelperClass\CreateUser as J3CreateUser; + + +/** + * Architecture Component Helper Class Service Provider + * + * @since 5.0.2 + */ +class ArchitectureComHelperClass implements ServiceProviderInterface +{ + /** + * Current Joomla Version Being Build + * + * @var int + * @since 5.0.2 + **/ + protected $targetVersion; + + /** + * Registers the service provider with a DI container. + * + * @param Container $container The DI container. + * + * @return void + * @since 5.0.2 + */ + public function register(Container $container) + { + $container->alias(CreateUserInterface::class, 'Architecture.ComHelperClass.CreateUser') + ->share('Architecture.ComHelperClass.CreateUser', [$this, 'getCreateUser'], true); + + $container->alias(J5CreateUser::class, 'Architecture.ComHelperClass.J5.CreateUser') + ->share('Architecture.ComHelperClass.J5.CreateUser', [$this, 'getJ5CreateUser'], true); + + $container->alias(J4CreateUser::class, 'Architecture.ComHelperClass.J4.CreateUser') + ->share('Architecture.ComHelperClass.J4.CreateUser', [$this, 'getJ4CreateUser'], true); + + $container->alias(J3CreateUser::class, 'Architecture.ComHelperClass.J3.CreateUser') + ->share('Architecture.ComHelperClass.J3.CreateUser', [$this, 'getJ3CreateUser'], true); + } + + /** + * Get The CreateUserInterface Class. + * + * @param Container $container The DI container. + * + * @return CreateUserInterface + * @since 5.0.2 + */ + public function getCreateUser(Container $container): CreateUserInterface + { + if (empty($this->targetVersion)) + { + $this->targetVersion = $container->get('Config')->joomla_version; + } + + return $container->get('Architecture.ComHelperClass.J' . $this->targetVersion . '.CreateUser'); + } + + /** + * Get The CreateUser Class. + * + * @param Container $container The DI container. + * + * @return J5CreateUser + * @since 5.0.2 + */ + public function getJ5CreateUser(Container $container): J5CreateUser + { + return new J5CreateUser(); + } + + /** + * Get The CreateUser Class. + * + * @param Container $container The DI container. + * + * @return J4CreateUser + * @since 5.0.2 + */ + public function getJ4CreateUser(Container $container): J4CreateUser + { + return new J4CreateUser(); + } + + /** + * Get The CreateUser Class. + * + * @param Container $container The DI container. + * + * @return J3CreateUser + * @since 5.0.2 + */ + public function getJ3CreateUser(Container $container): J3CreateUser + { + return new J3CreateUser(); + } +} + diff --git a/src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/code.power b/src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/code.power new file mode 100644 index 0000000..ee41b4a --- /dev/null +++ b/src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/code.power @@ -0,0 +1,87 @@ + /** + * Current Joomla Version Being Build + * + * @var int + * @since 5.0.2 + **/ + protected $targetVersion; + + /** + * Registers the service provider with a DI container. + * + * @param Container $container The DI container. + * + * @return void + * @since 5.0.2 + */ + public function register(Container $container) + { + $container->alias(CreateUserInterface::class, 'Architecture.ComHelperClass.CreateUser') + ->share('Architecture.ComHelperClass.CreateUser', [$this, 'getCreateUser'], true); + + $container->alias(J5CreateUser::class, 'Architecture.ComHelperClass.J5.CreateUser') + ->share('Architecture.ComHelperClass.J5.CreateUser', [$this, 'getJ5CreateUser'], true); + + $container->alias(J4CreateUser::class, 'Architecture.ComHelperClass.J4.CreateUser') + ->share('Architecture.ComHelperClass.J4.CreateUser', [$this, 'getJ4CreateUser'], true); + + $container->alias(J3CreateUser::class, 'Architecture.ComHelperClass.J3.CreateUser') + ->share('Architecture.ComHelperClass.J3.CreateUser', [$this, 'getJ3CreateUser'], true); + } + + /** + * Get The CreateUserInterface Class. + * + * @param Container $container The DI container. + * + * @return CreateUserInterface + * @since 5.0.2 + */ + public function getCreateUser(Container $container): CreateUserInterface + { + if (empty($this->targetVersion)) + { + $this->targetVersion = $container->get('Config')->joomla_version; + } + + return $container->get('Architecture.ComHelperClass.J' . $this->targetVersion . '.CreateUser'); + } + + /** + * Get The CreateUser Class. + * + * @param Container $container The DI container. + * + * @return J5CreateUser + * @since 5.0.2 + */ + public function getJ5CreateUser(Container $container): J5CreateUser + { + return new J5CreateUser(); + } + + /** + * Get The CreateUser Class. + * + * @param Container $container The DI container. + * + * @return J4CreateUser + * @since 5.0.2 + */ + public function getJ4CreateUser(Container $container): J4CreateUser + { + return new J4CreateUser(); + } + + /** + * Get The CreateUser Class. + * + * @param Container $container The DI container. + * + * @return J3CreateUser + * @since 5.0.2 + */ + public function getJ3CreateUser(Container $container): J3CreateUser + { + return new J3CreateUser(); + } \ No newline at end of file diff --git a/src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/settings.json b/src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/settings.json new file mode 100644 index 0000000..b97d93c --- /dev/null +++ b/src/8cd3c4aa-8daf-4e40-a943-456f46112c7b/settings.json @@ -0,0 +1,39 @@ +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "", + "guid": "8cd3c4aa-8daf-4e40-a943-456f46112c7b", + "implements": [ + "-1" + ], + "load_selection": null, + "name": "ArchitectureComHelperClass", + "power_version": "1.0.0", + "system_name": "JCB.Compiler.Service.ArchitectureComHelperClass", + "type": "class", + "use_selection": { + "use_selection0": { + "use": "5247cc17-b620-4cf3-9a1e-d0589b36ab35", + "as": "default" + }, + "use_selection1": { + "use": "0b02ece5-4968-4e65-bf71-5999c4d8c4aa", + "as": "J5CreateUser" + }, + "use_selection2": { + "use": "ecf774ca-82d9-42e1-a1b5-903c6ca9efe3", + "as": "J4CreateUser" + }, + "use_selection3": { + "use": "8c7abe76-516e-4c4f-97c1-244ca43b7726", + "as": "J3CreateUser" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Compiler.Service.ArchitectureComHelperClass", + "description": "Architecture Component Helper Class Service Provider\r\n\r\n@since 5.0.2", + "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/927fc3eb-9332-43ec-b903-ce16dcf6df09/README.md b/src/927fc3eb-9332-43ec-b903-ce16dcf6df09/README.md new file mode 100644 index 0000000..800ba08 --- /dev/null +++ b/src/927fc3eb-9332-43ec-b903-ce16dcf6df09/README.md @@ -0,0 +1,123 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Main (Details) +> namespace: **VDM\Joomla\Componentbuilder\Fieldtype\Readme** + +```uml +@startuml +class Main << (F,LightGreen) >> #RoyalBlue { + + get(array $items) : string + - readmeBuilder($items) : string + - readmeModel(array $classes) : string + - generateIndex(array $classes) : string + - sortClasses(array $classes) : void + - compareName(array $a, array $b) : int + - indexLinkPower(array $power) : string + - linkPowerRepo(array $power) : string + - linkPowerSettings(array $power) : string + - linkPowerDesc(array $power) : string +} + +note right of Main::get + Get Main Readme + + since: 3.2.0 + return: string +end note + +note left of Main::readmeBuilder + The readme builder + + since: 3.2.0 + return: string +end note + +note right of Main::readmeModel + Sort and model the readme classes + + since: 3.2.0 + return: string +end note + +note left of Main::generateIndex + Generate the index string for classes + + return: string +end note + +note right of Main::sortClasses + Sort the flattened array using a single sorting function + + since: 3.2.0 + return: void +end note + +note left of Main::compareName + Compare the name of two classes + + since: 3.2.0 + return: int +end note + +note right of Main::indexLinkPower + Build the Link to the power in this repository + + since: 3.2.0 + return: string +end note + +note left of Main::linkPowerRepo + Build the Link to the power in this repository + + since: 3.2.0 + return: string +end note + +note right of Main::linkPowerSettings + Build the Link to the power settings in this repository + + since: 3.2.0 + return: string +end note + +note left of Main::linkPowerDesc + Get the short description + + since: 3.2.0 + return: string +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---927fc3eb_9332_43ec_b903_ce16dcf6df09---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/927fc3eb-9332-43ec-b903-ce16dcf6df09/code.php b/src/927fc3eb-9332-43ec-b903-ce16dcf6df09/code.php new file mode 100644 index 0000000..b8acd21 --- /dev/null +++ b/src/927fc3eb-9332-43ec-b903-ce16dcf6df09/code.php @@ -0,0 +1,234 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Fieldtype\Readme; + + +use VDM\Joomla\Interfaces\Readme\MainInterface; + + +/** + * Field Type Main Readme + * + * @since 5.0.3 + */ +final class Main implements MainInterface +{ + /** + * Get Main Readme + * + * @param array $items All items of this repository. + * + * @return string + * @since 3.2.0 + */ + public function get(array $items): string + { + // build readme + $readme = ["``` + ██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗ + ██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗ + ██║██║ ██║██║ ██║██╔████╔██║██║ ███████║ +██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║ +╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║ + ╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + +███████╗██╗███████╗██╗ ██████╗ ████████╗██╗ ██╗██████╗ ███████╗███████╗ +██╔════╝██║██╔════╝██║ ██╔══██╗ ╚══██╔══╝╚██╗ ██╔╝██╔══██╗██╔════╝██╔════╝ +█████╗ ██║█████╗ ██║ ██║ ██║ ██║ ╚████╔╝ ██████╔╝█████╗ ███████╗ +██╔══╝ ██║██╔══╝ ██║ ██║ ██║ ██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ╚════██║ +██║ ██║███████╗███████╗██████╔╝ ██║ ██║ ██║ ███████╗███████║ +╚═╝ ╚═╝╚══════╝╚══════╝╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝ +```"]; + + // default description of super powers + $readme[] = "\n### What is JCB Joomla Field Types?\nThe Joomla field types provide a powerful way to map Joomla-related field types, enabling seamless integration with Joomla Component Builder (JCB). This repository serves as a centralized system for maintaining, updating, and distributing these field types throughout the JCB ecosystem.\n +\n +When you need to update any field type in JCB, simply select the desired field type and click the \"reset\" button. This action will automatically sync the selected field type with its corresponding version hosted in our core repository, ensuring you always have the latest updates.\n +\n +Moreover, if you wish to tailor the field types to your specific needs, you can fork the repository and point your JCB instance to your fork. This allows you to maintain and update field types independently from the main JCB community, offering the flexibility that is at the heart of open-source philosophy.\n +\n +We believe this approach empowers you to extend and customize JCB to fit your unique requirements, exemplifying the true spirit of freedom in software development. We trust you will find this capability both useful and aligned with the expectations of how open-source software should function.\n"; + + // get the readme body + $readme[] = $this->readmeBuilder($items); + + // yes you can remove this, but why? + $readme[] = "\n---\n``` + ██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗ + ██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗ + ██║██║ ██║██║ ██║██╔████╔██║██║ ███████║ +██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║ +╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║ + ╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + ██████╗ ██████╗ ███╗ ███╗██████╗ ██████╗ ███╗ ██╗███████╗███╗ ██╗████████╗ +██╔════╝██╔═══██╗████╗ ████║██╔══██╗██╔═══██╗████╗ ██║██╔════╝████╗ ██║╚══██╔══╝ +██║ ██║ ██║██╔████╔██║██████╔╝██║ ██║██╔██╗ ██║█████╗ ██╔██╗ ██║ ██║ +██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██║██║╚██╗██║██╔══╝ ██║╚██╗██║ ██║ +╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚██████╔╝██║ ╚████║███████╗██║ ╚████║ ██║ + ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═══╝ ╚═╝ +██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗ +██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗ +██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝ +██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗ +██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║ +╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝ +```\n> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)\n\n"; + + return implode("\n", $readme); + } + + /** + * The readme builder + * + * @param array $classes The powers. + * + * @return string + * @since 3.2.0 + */ + private function readmeBuilder(array &$items): string + { + $classes = []; + foreach ($items as $guid => $power) + { + // add to the sort bucket + $classes[] = [ + 'name' => $power['name'], + 'link' => $this->indexLinkPower($power) + ]; + } + + return $this->readmeModel($classes); + } + + /** + * Sort and model the readme classes + * + * @param array $classes The powers. + * + * @return string + * @since 3.2.0 + */ + private function readmeModel(array &$classes): string + { + $this->sortClasses($classes); + + return $this->generateIndex($classes); + } + + /** + * Generate the index string for classes + * + * @param array $classes The sorted classes + * + * @return string The index string + */ + private function generateIndex(array &$classes): string + { + $result = "# Index of Joomla! Field Types\n"; + + foreach ($classes as $class) + { + // Add the class details + $result .= "\n - " . $class['link']; + } + + return $result; + } + + /** + * Sort the flattened array using a single sorting function + * + * @param array $classes The classes to sort + * + * @since 3.2.0 + */ + private function sortClasses(array &$classes): void + { + usort($classes, function ($a, $b) { + return $this->compareName($a, $b); + }); + } + + /** + * Compare the name of two classes + * + * @param array $a First class + * @param array $b Second class + * + * @return int Comparison result + * @since 3.2.0 + */ + private function compareName(array $a, array $b): int + { + return strcmp($a['name'], $b['name']); + } + + /** + * Build the Link to the power in this repository + * + * @param array $power The power details. + * + * @return string + * @since 3.2.0 + */ + private function indexLinkPower(array &$power): string + { + $name = $power['name'] ?? 'error'; + return '**' . $name . "** | " + . $this->linkPowerRepo($power) . ' | ' + . $this->linkPowerSettings($power) . ' | ' + . $this->linkPowerDesc($power); + } + + /** + * Build the Link to the power in this repository + * + * @param array $power The power details. + * + * @return string + * @since 3.2.0 + */ + private function linkPowerRepo(array &$power): string + { + $path = $power['path'] ?? 'error'; + return '[Details](' . $path . ')'; + } + + /** + * Build the Link to the power settings in this repository + * + * @param array $power The power details. + * + * @return string + * @since 3.2.0 + */ + private function linkPowerSettings(array &$power): string + { + $settings = $power['settings'] ?? 'error'; + return '[Settings](' . $settings . ')'; + } + + /** + * Get the short description + * + * @param array $power The power details. + * + * @return string + * @since 3.2.0 + */ + private function linkPowerDesc(array &$power): string + { + $jpk = $power['desc'] ?? ''; + return $jpk; + } +} + diff --git a/src/927fc3eb-9332-43ec-b903-ce16dcf6df09/code.power b/src/927fc3eb-9332-43ec-b903-ce16dcf6df09/code.power new file mode 100644 index 0000000..0700288 --- /dev/null +++ b/src/927fc3eb-9332-43ec-b903-ce16dcf6df09/code.power @@ -0,0 +1,208 @@ + /** + * Get Main Readme + * + * @param array $items All items of this repository. + * + * @return string + * @since 3.2.0 + */ + public function get(array $items): string + { + // build readme + $readme = ["``` + ██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗ + ██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗ + ██║██║ ██║██║ ██║██╔████╔██║██║ ███████║ +██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║ +╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║ + ╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + +███████╗██╗███████╗██╗ ██████╗ ████████╗██╗ ██╗██████╗ ███████╗███████╗ +██╔════╝██║██╔════╝██║ ██╔══██╗ ╚══██╔══╝╚██╗ ██╔╝██╔══██╗██╔════╝██╔════╝ +█████╗ ██║█████╗ ██║ ██║ ██║ ██║ ╚████╔╝ ██████╔╝█████╗ ███████╗ +██╔══╝ ██║██╔══╝ ██║ ██║ ██║ ██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ╚════██║ +██║ ██║███████╗███████╗██████╔╝ ██║ ██║ ██║ ███████╗███████║ +╚═╝ ╚═╝╚══════╝╚══════╝╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝ +```"]; + + // default description of super powers + $readme[] = "\n### What is JCB Joomla Field Types?\nThe Joomla field types provide a powerful way to map Joomla-related field types, enabling seamless integration with Joomla Component Builder (JCB). This repository serves as a centralized system for maintaining, updating, and distributing these field types throughout the JCB ecosystem.\n +\n +When you need to update any field type in JCB, simply select the desired field type and click the \"reset\" button. This action will automatically sync the selected field type with its corresponding version hosted in our core repository, ensuring you always have the latest updates.\n +\n +Moreover, if you wish to tailor the field types to your specific needs, you can fork the repository and point your JCB instance to your fork. This allows you to maintain and update field types independently from the main JCB community, offering the flexibility that is at the heart of open-source philosophy.\n +\n +We believe this approach empowers you to extend and customize JCB to fit your unique requirements, exemplifying the true spirit of freedom in software development. We trust you will find this capability both useful and aligned with the expectations of how open-source software should function.\n"; + + // get the readme body + $readme[] = $this->readmeBuilder($items); + + // yes you can remove this, but why? + $readme[] = "\n---\n``` + ██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗ + ██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗ + ██║██║ ██║██║ ██║██╔████╔██║██║ ███████║ +██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║ +╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║ + ╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + ██████╗ ██████╗ ███╗ ███╗██████╗ ██████╗ ███╗ ██╗███████╗███╗ ██╗████████╗ +██╔════╝██╔═══██╗████╗ ████║██╔══██╗██╔═══██╗████╗ ██║██╔════╝████╗ ██║╚══██╔══╝ +██║ ██║ ██║██╔████╔██║██████╔╝██║ ██║██╔██╗ ██║█████╗ ██╔██╗ ██║ ██║ +██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██║██║╚██╗██║██╔══╝ ██║╚██╗██║ ██║ +╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚██████╔╝██║ ╚████║███████╗██║ ╚████║ ██║ + ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═══╝ ╚═╝ +██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗ +██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗ +██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝ +██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗ +██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║ +╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝ +```\n> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)\n\n"; + + return implode("\n", $readme); + } + + /** + * The readme builder + * + * @param array $classes The powers. + * + * @return string + * @since 3.2.0 + */ + private function readmeBuilder(array &$items): string + { + $classes = []; + foreach ($items as $guid => $power) + { + // add to the sort bucket + $classes[] = [ + 'name' => $power['name'], + 'link' => $this->indexLinkPower($power) + ]; + } + + return $this->readmeModel($classes); + } + + /** + * Sort and model the readme classes + * + * @param array $classes The powers. + * + * @return string + * @since 3.2.0 + */ + private function readmeModel(array &$classes): string + { + $this->sortClasses($classes); + + return $this->generateIndex($classes); + } + + /** + * Generate the index string for classes + * + * @param array $classes The sorted classes + * + * @return string The index string + */ + private function generateIndex(array &$classes): string + { + $result = "# Index of Joomla! Field Types\n"; + + foreach ($classes as $class) + { + // Add the class details + $result .= "\n - " . $class['link']; + } + + return $result; + } + + /** + * Sort the flattened array using a single sorting function + * + * @param array $classes The classes to sort + * + * @since 3.2.0 + */ + private function sortClasses(array &$classes): void + { + usort($classes, function ($a, $b) { + return $this->compareName($a, $b); + }); + } + + /** + * Compare the name of two classes + * + * @param array $a First class + * @param array $b Second class + * + * @return int Comparison result + * @since 3.2.0 + */ + private function compareName(array $a, array $b): int + { + return strcmp($a['name'], $b['name']); + } + + /** + * Build the Link to the power in this repository + * + * @param array $power The power details. + * + * @return string + * @since 3.2.0 + */ + private function indexLinkPower(array &$power): string + { + $name = $power['name'] ?? 'error'; + return '**' . $name . "** | " + . $this->linkPowerRepo($power) . ' | ' + . $this->linkPowerSettings($power) . ' | ' + . $this->linkPowerDesc($power); + } + + /** + * Build the Link to the power in this repository + * + * @param array $power The power details. + * + * @return string + * @since 3.2.0 + */ + private function linkPowerRepo(array &$power): string + { + $path = $power['path'] ?? 'error'; + return '[Details](' . $path . ')'; + } + + /** + * Build the Link to the power settings in this repository + * + * @param array $power The power details. + * + * @return string + * @since 3.2.0 + */ + private function linkPowerSettings(array &$power): string + { + $settings = $power['settings'] ?? 'error'; + return '[Settings](' . $settings . ')'; + } + + /** + * Get the short description + * + * @param array $power The power details. + * + * @return string + * @since 3.2.0 + */ + private function linkPowerDesc(array &$power): string + { + $jpk = $power['desc'] ?? ''; + return $jpk; + } \ No newline at end of file diff --git a/src/927fc3eb-9332-43ec-b903-ce16dcf6df09/settings.json b/src/927fc3eb-9332-43ec-b903-ce16dcf6df09/settings.json new file mode 100644 index 0000000..a91bdfe --- /dev/null +++ b/src/927fc3eb-9332-43ec-b903-ce16dcf6df09/settings.json @@ -0,0 +1,21 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "", + "guid": "927fc3eb-9332-43ec-b903-ce16dcf6df09", + "implements": [ + "217416f6-24cf-41c0-b18e-11086111d447" + ], + "load_selection": null, + "name": "Main", + "power_version": "1.0.0", + "system_name": "JCB.Fieldtype.Readme.Main", + "type": "final class", + "use_selection": null, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Fieldtype.Readme.Main", + "description": "Field Type Main Readme\r\n\r\n@since 5.0.3", + "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/a8d9583a-6ddb-4aac-b0d1-4c2d2d1c8c74/code.php b/src/a8d9583a-6ddb-4aac-b0d1-4c2d2d1c8c74/code.php index 3904bf7..b4e3568 100644 --- a/src/a8d9583a-6ddb-4aac-b0d1-4c2d2d1c8c74/code.php +++ b/src/a8d9583a-6ddb-4aac-b0d1-4c2d2d1c8c74/code.php @@ -138,7 +138,7 @@ final class ConfigFieldsetsGroupControl { $this->configfieldsets->add('component', Indent::_(2) . 'configfieldsets->add('component', Indent::_(3) . 'type="usergroup"'); + $this->configfieldsets->add('component', Indent::_(3) . 'type="usergrouplist"'); $this->configfieldsets->add('component', Indent::_(3) . 'label="' . $label . '"'); $this->configfieldsets->add('component', Indent::_(3) . 'description="' . $lang . '_TARGET_GROUP_DESC"'); diff --git a/src/a8d9583a-6ddb-4aac-b0d1-4c2d2d1c8c74/code.power b/src/a8d9583a-6ddb-4aac-b0d1-4c2d2d1c8c74/code.power index e5b9f05..4cd0b2c 100644 --- a/src/a8d9583a-6ddb-4aac-b0d1-4c2d2d1c8c74/code.power +++ b/src/a8d9583a-6ddb-4aac-b0d1-4c2d2d1c8c74/code.power @@ -108,7 +108,7 @@ { $this->configfieldsets->add('component', Indent::_(2) . 'configfieldsets->add('component', Indent::_(3) . 'type="usergroup"'); + $this->configfieldsets->add('component', Indent::_(3) . 'type="usergrouplist"'); $this->configfieldsets->add('component', Indent::_(3) . 'label="' . $label . '"'); $this->configfieldsets->add('component', Indent::_(3) . 'description="' . $lang . '_TARGET_GROUP_DESC"'); diff --git a/src/baf83354-0be5-410e-80f9-2b64b052e482/README.md b/src/baf83354-0be5-410e-80f9-2b64b052e482/README.md new file mode 100644 index 0000000..31d642d --- /dev/null +++ b/src/baf83354-0be5-410e-80f9-2b64b052e482/README.md @@ -0,0 +1,98 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# class Config (Details) +> namespace: **VDM\Joomla\Componentbuilder\Fieldtype** +> extends: **BaseConfig** + +```uml +@startuml +class Config #Gold { + # JoomlaRegistry $config + + __construct(?Input $input = null, ?JoomlaRegistry $params = null, ...) + # getGiteausername() : ?string + # getGiteatoken() : ?string + # getJoomlafieldtypecoreorganisation() : string + # getJoomlafieldtypeinitrepos() : array + # getApprovedjoomlapaths() : array +} + +note right of Config::__construct + Constructor + + since: 5.0.3 + + arguments: + ?Input $input = null + ?JoomlaRegistry $params = null + ?JoomlaRegistry $config = null +end note + +note right of Config::getGiteausername + get Gitea Username + + since: 5.0.3 + return: ?string +end note + +note right of Config::getGiteatoken + get Gitea Access Token + + since: 5.0.3 + return: ?string +end note + +note right of Config::getJoomlafieldtypecoreorganisation + Get fieldtype core organisation + + since: 5.0.3 + return: string +end note + +note right of Config::getJoomlafieldtypeinitrepos + Get Joomla fieldtype init repos + + since: 5.0.3 + return: array +end note + +note right of Config::getApprovedjoomlapaths + Get joomla fieldtype approved paths + + since: 5.0.3 + return: array +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---baf83354_0be5_410e_80f9_2b64b052e482---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/baf83354-0be5-410e-80f9-2b64b052e482/code.php b/src/baf83354-0be5-410e-80f9-2b64b052e482/code.php new file mode 100644 index 0000000..d5a163f --- /dev/null +++ b/src/baf83354-0be5-410e-80f9-2b64b052e482/code.php @@ -0,0 +1,147 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Fieldtype; + + +use Joomla\Registry\Registry as JoomlaRegistry; +use Joomla\CMS\Factory as JoomlaFactory; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Componentbuilder\Utilities\RepoHelper; +use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig; + + +/** + * Compiler Configurations + * + * All these functions are accessed via the direct name without the get: + * example: $this->component_code_name calls: $this->getComponentcodename() + * + * All values once called are cached, yet can be updated directly: + * example: $this->component_code_name = 'new_code_name'; // be warned! + * + * @since 5.0.3 + */ +class Config extends BaseConfig +{ + /** + * The Global Joomla Configuration + * + * @var JoomlaRegistry + * @since 5.0.3 + */ + protected JoomlaRegistry $config; + + /** + * Constructor + * + * @param Input|null $input Input + * @param Registry|null $params The component parameters + * @param Registry|null $config The Joomla configuration + * + * @throws \Exception + * @since 5.0.3 + */ + public function __construct(?Input $input = null, ?JoomlaRegistry $params = null, ?JoomlaRegistry $config = null) + { + parent::__construct($input, $params); + + $this->config = $config ?: JoomlaFactory::getConfig(); + } + + /** + * get Gitea Username + * + * @return string the access token + * @since 5.0.3 + */ + protected function getGiteausername(): ?string + { + return $this->params->get('gitea_username'); + } + + /** + * get Gitea Access Token + * + * @return string the access token + * @since 5.0.3 + */ + protected function getGiteatoken(): ?string + { + return $this->params->get('gitea_token'); + } + + /** + * Get fieldtype core organisation + * + * @return string The fieldtype core organisation + * @since 5.0.3 + */ + protected function getJoomlafieldtypecoreorganisation(): string + { + // the VDM default organisation is [joomla] + $organisation = 'joomla'; + + return $this->params->get('joomla_fieldtype_core_organisation', $organisation); + } + + /** + * Get Joomla fieldtype init repos + * + * @return array The init repositories on Gitea + * @since 5.0.3 + */ + protected function getJoomlafieldtypeinitrepos(): array + { + // some defaults repos we need by JCB + $repos = []; + // get the users own power repo (can overwrite all) + if (!empty($this->gitea_username)) + { + $repos[$this->gitea_username . '.joomla-fieldtypes'] = (object) ['organisation' => $this->gitea_username, 'repository' => 'joomla-fieldtypes', 'read_branch' => 'master']; + } + $repos[$this->joomla_fieldtype_core_organisation . '.joomla-fieldtypes'] = (object) ['organisation' => $this->joomla_fieldtype_core_organisation, 'repository' => 'joomla-fieldtypes', 'read_branch' => 'master']; + + return $repos; + } + + /** + * Get joomla fieldtype approved paths + * + * @return array The approved paths to the repositories on Gitea + * @since 5.0.3 + */ + protected function getApprovedjoomlapaths(): array + { + // some defaults repos we need by JCB + $approved = $this->joomla_fieldtype_init_repos; + + $paths = RepoHelper::get(3); // Joomla Field Type = 3 + + if ($paths !== null) + { + foreach ($paths as $path) + { + $owner = $path->organisation ?? null; + $repo = $path->repository ?? null; + if ($owner !== null && $repo !== null) + { + // we make sure to get only the objects + $approved = ["{$owner}.{$repo}" => $path] + $approved; + } + } + } + + return array_values($approved); + } +} + diff --git a/src/baf83354-0be5-410e-80f9-2b64b052e482/code.power b/src/baf83354-0be5-410e-80f9-2b64b052e482/code.power new file mode 100644 index 0000000..cdcd286 --- /dev/null +++ b/src/baf83354-0be5-410e-80f9-2b64b052e482/code.power @@ -0,0 +1,110 @@ + /** + * The Global Joomla Configuration + * + * @var JoomlaRegistry + * @since 5.0.3 + */ + protected JoomlaRegistry $config; + + /** + * Constructor + * + * @param Input|null $input Input + * @param Registry|null $params The component parameters + * @param Registry|null $config The Joomla configuration + * + * @throws \Exception + * @since 5.0.3 + */ + public function __construct(?Input $input = null, ?JoomlaRegistry $params = null, ?JoomlaRegistry $config = null) + { + parent::__construct($input, $params); + + $this->config = $config ?: JoomlaFactory::getConfig(); + } + + /** + * get Gitea Username + * + * @return string the access token + * @since 5.0.3 + */ + protected function getGiteausername(): ?string + { + return $this->params->get('gitea_username'); + } + + /** + * get Gitea Access Token + * + * @return string the access token + * @since 5.0.3 + */ + protected function getGiteatoken(): ?string + { + return $this->params->get('gitea_token'); + } + + /** + * Get fieldtype core organisation + * + * @return string The fieldtype core organisation + * @since 5.0.3 + */ + protected function getJoomlafieldtypecoreorganisation(): string + { + // the VDM default organisation is [joomla] + $organisation = 'joomla'; + + return $this->params->get('joomla_fieldtype_core_organisation', $organisation); + } + + /** + * Get Joomla fieldtype init repos + * + * @return array The init repositories on Gitea + * @since 5.0.3 + */ + protected function getJoomlafieldtypeinitrepos(): array + { + // some defaults repos we need by JCB + $repos = []; + // get the users own power repo (can overwrite all) + if (!empty($this->gitea_username)) + { + $repos[$this->gitea_username . '.joomla-fieldtypes'] = (object) ['organisation' => $this->gitea_username, 'repository' => 'joomla-fieldtypes', 'read_branch' => 'master']; + } + $repos[$this->joomla_fieldtype_core_organisation . '.joomla-fieldtypes'] = (object) ['organisation' => $this->joomla_fieldtype_core_organisation, 'repository' => 'joomla-fieldtypes', 'read_branch' => 'master']; + + return $repos; + } + + /** + * Get joomla fieldtype approved paths + * + * @return array The approved paths to the repositories on Gitea + * @since 5.0.3 + */ + protected function getApprovedjoomlapaths(): array + { + // some defaults repos we need by JCB + $approved = $this->joomla_fieldtype_init_repos; + + $paths = RepoHelper::get(3); // Joomla Field Type = 3 + + if ($paths !== null) + { + foreach ($paths as $path) + { + $owner = $path->organisation ?? null; + $repo = $path->repository ?? null; + if ($owner !== null && $repo !== null) + { + // we make sure to get only the objects + $approved = ["{$owner}.{$repo}" => $path] + $approved; + } + } + } + + return array_values($approved); + } \ No newline at end of file diff --git a/src/baf83354-0be5-410e-80f9-2b64b052e482/settings.json b/src/baf83354-0be5-410e-80f9-2b64b052e482/settings.json new file mode 100644 index 0000000..8839115 --- /dev/null +++ b/src/baf83354-0be5-410e-80f9-2b64b052e482/settings.json @@ -0,0 +1,32 @@ +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "9769f3b2-17bf-4f20-b54b-3a4ebe572b36", + "guid": "baf83354-0be5-410e-80f9-2b64b052e482", + "implements": null, + "load_selection": null, + "name": "Config", + "power_version": "1.0.0", + "system_name": "JCB.Fieldtype.Config", + "type": "class", + "use_selection": { + "use_selection0": { + "use": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc", + "as": "default" + }, + "use_selection1": { + "use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef", + "as": "default" + }, + "use_selection2": { + "use": "c6619b00-261c-473b-8094-d4fe9e6bab39", + "as": "default" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Fieldtype.Config", + "description": "Compiler Configurations\r\n\r\n\tAll these functions are accessed via the direct name without the get:\r\n\texample: $this->component_code_name calls: $this->getComponentcodename()\r\n\r\n\tAll values once called are cached, yet can be updated directly:\r\n\texample: $this->component_code_name = 'new_code_name'; \/\/ be warned!\r\n\r\n@since 5.0.3", + "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;\r\nuse Joomla\\CMS\\Factory as JoomlaFactory;", + "composer": "" +} \ No newline at end of file diff --git a/src/c6619b00-261c-473b-8094-d4fe9e6bab39/settings.json b/src/c6619b00-261c-473b-8094-d4fe9e6bab39/settings.json index 474b773..23c0349 100644 --- a/src/c6619b00-261c-473b-8094-d4fe9e6bab39/settings.json +++ b/src/c6619b00-261c-473b-8094-d4fe9e6bab39/settings.json @@ -7,7 +7,7 @@ "load_selection": null, "name": "RepoHelper", "power_version": "1.0.0", - "system_name": "JCB.Utilities.RepoHelper", + "system_name": "Joomla.Utilities.RepoHelper", "type": "abstract class", "use_selection": { "use_selection0": { diff --git a/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/README.md b/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/README.md new file mode 100644 index 0000000..d730be7 --- /dev/null +++ b/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/README.md @@ -0,0 +1,106 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Set (Details) +> namespace: **VDM\Joomla\Componentbuilder\Fieldtype\Remote** +> extends: **ExtendingSet** + +```uml +@startuml +class Set << (F,LightGreen) >> #RoyalBlue { + # string $table + # string $area + # array $map + # updateItem(object $item, object $existing, ...) : bool + # createItem(object $item, object $repo) : void + # updateItemReadme(object $item, object $existing, ...) : void + # createItemReadme(object $item, object $repo) : void + # index_map_IndexName(object $item) : ?string + # index_map_ShortDescription(object $item) : ?string +} + +note right of Set::updateItem + update an existing item (if changed) + + since: 5.0.3 + return: bool + + arguments: + object $item + object $existing + object $repo +end note + +note right of Set::createItem + create a new item + + since: 5.0.3 + return: void +end note + +note right of Set::updateItemReadme + update an existing item readme + + since: 5.0.3 + return: void + + arguments: + object $item + object $existing + object $repo +end note + +note right of Set::createItemReadme + create a new item readme + + since: 5.0.3 + return: void +end note + +note right of Set::index_map_IndexName + Get the item name for the index values + + since: 5.0.3 + return: ?string +end note + +note right of Set::index_map_ShortDescription + Get the item Short Description for the index values + + since: 5.0.3 + return: ?string +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---d45b9f58_e4d7_4b0a_be05_e34c6fa215c8---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/code.php b/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/code.php new file mode 100644 index 0000000..6155454 --- /dev/null +++ b/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/code.php @@ -0,0 +1,218 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Fieldtype\Remote; + + +use VDM\Joomla\Interfaces\Remote\SetInterface; +use VDM\Joomla\Abstraction\Remote\Set as ExtendingSet; + + +/** + * Set Field Type based on global unique ids to remote repository + * + * @since 5.0.3 + */ +final class Set extends ExtendingSet implements SetInterface +{ + /** + * Table Name + * + * @var string + * @since 5.0.3 + */ + protected string $table = 'fieldtype'; + + /** + * Area Name + * + * @var string + * @since 5.0.3 + */ + protected string $area = 'Joomla Field Type'; + + /** + * Prefix Key + * + * @var string + * @since 5.0.3 + */ + protected string $prefix_key = ''; + + /** + * The item map + * + * @var array + * @since 5.0.3 + */ + protected array $map = [ + 'name' => 'name', + 'short_description' => 'short_description', + 'description' => 'description', + 'properties' => 'properties', + 'has_defaults' => 'has_defaults', + 'datatype' => 'datatype', + 'datalenght' => 'datalenght', + 'datalenght_other' => 'datalenght_other', + 'datadefault' => 'datadefault', + 'datadefault_other' => 'datadefault_other', + 'indexes' => 'indexes', + 'null_switch' => 'null_switch', + 'store' => 'store', + 'guid' => 'guid' + ]; + + /** + * The index map + * + * @var array + * @since 5.0.3 + */ + protected array $index_map = [ + 'name' => 'index_map_IndexName', + 'desc' => 'index_map_ShortDescription', + 'settings' => 'index_map_IndexSettingsPath', + 'path' => 'index_map_IndexPath', + 'guid' => 'index_map_IndexGUID' + ]; + + /** + * update an existing item (if changed) + * + * @param object $item + * @param object $existing + * @param object $repo + * + * @return bool + * @since 5.0.3 + */ + protected function updateItem(object $item, object $existing, object $repo): bool + { + // make sure there was a change + $sha = $existing->params->source[$repo->guid . '-settings'] ?? null; + $existing = $this->mapItem($existing); + if ($sha === null || $this->areObjectsEqual($item, $existing)) + { + return false; + } + + $this->git->update( + $repo->organisation, // The owner name. + $repo->repository, // The repository name. + 'src/' . $item->guid . '/' . $this->getSettingsPath(), // The file path. + json_encode($item, JSON_PRETTY_PRINT), // The file content. + 'Update ' . $item->name, // The commit message. + $sha, // The blob SHA of the old file. + $repo->write_branch // The branch name. + ); + + return true; + } + + /** + * create a new item + * + * @param object $item + * @param object $repo + * + * @return void + * @since 5.0.3 + */ + protected function createItem(object $item, object $repo): void + { + $this->git->create( + $repo->organisation, // The owner name. + $repo->repository, // The repository name. + 'src/' . $item->guid . '/' . $this->getSettingsPath(), // The file path. + json_encode($item, JSON_PRETTY_PRINT), // The file content. + 'Create ' . $item->name, // The commit message. + $repo->write_branch // The branch name. + ); + } + + /** + * update an existing item readme + * + * @param object $item + * @param object $existing + * @param object $repo + * + * @return void + * @since 5.0.3 + */ + protected function updateItemReadme(object $item, object $existing, object $repo): void + { + // make sure there was a change + $sha = $existing->params->source[$repo->guid . '-readme'] ?? null; + if ($sha === null) + { + return; + } + + $this->git->update( + $repo->organisation, // The owner name. + $repo->repository, // The repository name. + 'src/' . $item->guid . '/README.md', // The file path. + $this->itemReadme->get($item), // The file content. + 'Update ' . $item->name . ' readme file', // The commit message. + $sha, // The blob SHA of the old file. + $repo->write_branch // The branch name. + ); + } + + /** + * create a new item readme + * + * @param object $item + * @param object $repo + * + * @return void + * @since 5.0.3 + */ + protected function createItemReadme(object $item, object $repo): void + { + $this->git->create( + $repo->organisation, // The owner name. + $repo->repository, // The repository name. + 'src/' . $item->guid . '/README.md', // The file path. + $this->itemReadme->get($item), // The file content. + 'Create ' . $item->name . ' readme file', // The commit message. + $repo->write_branch // The branch name. + ); + } + + /** + * Get the item name for the index values + * + * @param object $item + * + * @return string|null + * @since 5.0.3 + */ + protected function index_map_IndexName(object $item): ?string + { + return $item->name ?? null; + } + + /** + * Get the item Short Description for the index values + * + * @param object $item + * + * @return string|null + * @since 5.0.3 + */ + protected function index_map_ShortDescription(object $item): ?string + { + return $item->short_description ?? null; + } +} + diff --git a/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/code.power b/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/code.power new file mode 100644 index 0000000..456465f --- /dev/null +++ b/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/code.power @@ -0,0 +1,191 @@ + /** + * Table Name + * + * @var string + * @since 5.0.3 + */ + protected string $table = 'fieldtype'; + + /** + * Area Name + * + * @var string + * @since 5.0.3 + */ + protected string $area = 'Joomla Field Type'; + + /** + * Prefix Key + * + * @var string + * @since 5.0.3 + */ + protected string $prefix_key = ''; + + /** + * The item map + * + * @var array + * @since 5.0.3 + */ + protected array $map = [ + 'name' => 'name', + 'short_description' => 'short_description', + 'description' => 'description', + 'properties' => 'properties', + 'has_defaults' => 'has_defaults', + 'datatype' => 'datatype', + 'datalenght' => 'datalenght', + 'datalenght_other' => 'datalenght_other', + 'datadefault' => 'datadefault', + 'datadefault_other' => 'datadefault_other', + 'indexes' => 'indexes', + 'null_switch' => 'null_switch', + 'store' => 'store', + 'guid' => 'guid' + ]; + + /** + * The index map + * + * @var array + * @since 5.0.3 + */ + protected array $index_map = [ + 'name' => 'index_map_IndexName', + 'desc' => 'index_map_ShortDescription', + 'settings' => 'index_map_IndexSettingsPath', + 'path' => 'index_map_IndexPath', + 'guid' => 'index_map_IndexGUID' + ]; + + /** + * update an existing item (if changed) + * + * @param object $item + * @param object $existing + * @param object $repo + * + * @return bool + * @since 5.0.3 + */ + protected function updateItem(object $item, object $existing, object $repo): bool + { + // make sure there was a change + $sha = $existing->params->source[$repo->guid . '-settings'] ?? null; + $existing = $this->mapItem($existing); + if ($sha === null || $this->areObjectsEqual($item, $existing)) + { + return false; + } + + $this->git->update( + $repo->organisation, // The owner name. + $repo->repository, // The repository name. + 'src/' . $item->guid . '/' . $this->getSettingsPath(), // The file path. + json_encode($item, JSON_PRETTY_PRINT), // The file content. + 'Update ' . $item->name, // The commit message. + $sha, // The blob SHA of the old file. + $repo->write_branch // The branch name. + ); + + return true; + } + + /** + * create a new item + * + * @param object $item + * @param object $repo + * + * @return void + * @since 5.0.3 + */ + protected function createItem(object $item, object $repo): void + { + $this->git->create( + $repo->organisation, // The owner name. + $repo->repository, // The repository name. + 'src/' . $item->guid . '/' . $this->getSettingsPath(), // The file path. + json_encode($item, JSON_PRETTY_PRINT), // The file content. + 'Create ' . $item->name, // The commit message. + $repo->write_branch // The branch name. + ); + } + + /** + * update an existing item readme + * + * @param object $item + * @param object $existing + * @param object $repo + * + * @return void + * @since 5.0.3 + */ + protected function updateItemReadme(object $item, object $existing, object $repo): void + { + // make sure there was a change + $sha = $existing->params->source[$repo->guid . '-readme'] ?? null; + if ($sha === null) + { + return; + } + + $this->git->update( + $repo->organisation, // The owner name. + $repo->repository, // The repository name. + 'src/' . $item->guid . '/README.md', // The file path. + $this->itemReadme->get($item), // The file content. + 'Update ' . $item->name . ' readme file', // The commit message. + $sha, // The blob SHA of the old file. + $repo->write_branch // The branch name. + ); + } + + /** + * create a new item readme + * + * @param object $item + * @param object $repo + * + * @return void + * @since 5.0.3 + */ + protected function createItemReadme(object $item, object $repo): void + { + $this->git->create( + $repo->organisation, // The owner name. + $repo->repository, // The repository name. + 'src/' . $item->guid . '/README.md', // The file path. + $this->itemReadme->get($item), // The file content. + 'Create ' . $item->name . ' readme file', // The commit message. + $repo->write_branch // The branch name. + ); + } + + /** + * Get the item name for the index values + * + * @param object $item + * + * @return string|null + * @since 5.0.3 + */ + protected function index_map_IndexName(object $item): ?string + { + return $item->name ?? null; + } + + /** + * Get the item Short Description for the index values + * + * @param object $item + * + * @return string|null + * @since 5.0.3 + */ + protected function index_map_ShortDescription(object $item): ?string + { + return $item->short_description ?? null; + } \ No newline at end of file diff --git a/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/settings.json b/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/settings.json new file mode 100644 index 0000000..c7af376 --- /dev/null +++ b/src/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8/settings.json @@ -0,0 +1,21 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "eb7d69c2-4ee9-4bd0-aacc-ab51a12be895", + "guid": "d45b9f58-e4d7-4b0a-be05-e34c6fa215c8", + "implements": [ + "e335dd61-c2f9-4536-8ed9-aec5edee0b26" + ], + "load_selection": null, + "name": "Set", + "power_version": "1.0.0", + "system_name": "JCB.Fieldtype.Remote.Set", + "type": "final class", + "use_selection": null, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Fieldtype.Remote.Set", + "description": "Set Field Type based on global unique ids to remote repository\r\n\r\n@since 5.0.3", + "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/d8d35836-60f2-4464-a306-097f079c4f13/README.md b/src/d8d35836-60f2-4464-a306-097f079c4f13/README.md new file mode 100644 index 0000000..5d882c7 --- /dev/null +++ b/src/d8d35836-60f2-4464-a306-097f079c4f13/README.md @@ -0,0 +1,77 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Grep (Details) +> namespace: **VDM\Joomla\Componentbuilder\Fieldtype** +> extends: **ExtendingGrep** + +```uml +@startuml +class Grep << (F,LightGreen) >> #RoyalBlue { + # array $order + # searchRemote(string $guid) : ?object + # getRemote(object $path, string $guid) : ?object + # setRemoteIndexMessage(string $message, string $path, ...) : void +} + +note right of Grep::searchRemote + Search for a remote item + + since: 5.0.3 + return: ?object +end note + +note right of Grep::getRemote + Get a remote joomla power + + since: 5.0.3 + return: ?object +end note + +note right of Grep::setRemoteIndexMessage + Set repository messages and errors based on given conditions. + + since: 5.0.3 + return: void + + arguments: + string $message + string $path + string $repository + string $organisation + ?string $base +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---d8d35836_60f2_4464_a306_097f079c4f13---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/d8d35836-60f2-4464-a306-097f079c4f13/code.php b/src/d8d35836-60f2-4464-a306-097f079c4f13/code.php new file mode 100644 index 0000000..b0e1ac1 --- /dev/null +++ b/src/d8d35836-60f2-4464-a306-097f079c4f13/code.php @@ -0,0 +1,151 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Fieldtype; + + +use Joomla\CMS\Language\Text; +use VDM\Joomla\Interfaces\GrepInterface; +use VDM\Joomla\Abstraction\Grep as ExtendingGrep; + + +/** + * Global Resource Empowerment Platform + * + * The Grep feature will try to find your joomla power in the repositories listed in the global + * Options of JCB in the super powers tab, and if it can't be found there will try the global core + * Super powers of JCB. All searches are performed according the [algorithm:cascading] + * See documentation for more details: https://git.vdm.dev/joomla/super-powers/wiki + * + * @since 5.0.3 + */ +final class Grep extends ExtendingGrep implements GrepInterface +{ + /** + * Order of global search + * + * @var array + * @since 5.0.3 + **/ + protected array $order = ['remote']; + + /** + * Search for a remote item + * + * @param string $guid The global unique id of the item + * + * @return object|null + * @since 5.0.3 + */ + protected function searchRemote(string $guid): ?object + { + // check if it exists remotely + if (($path = $this->existsRemotely($guid)) !== null) + { + return $this->getRemote($path, $guid); + } + + return null; + } + + /** + * Get a remote joomla power + * + * @param object $path The repository path details + * @param string $guid The global unique id of the power + * + * @return object|null + * @since 5.0.3 + */ + protected function getRemote(object $path, string $guid): ?object + { + $power = null; + if (empty($path->index->{$guid}->path)) + { + return $power; + } + + // get the branch name + $branch = $this->getBranchName($path); + + // load the base and token if set + $this->contents->load_($path->base ?? null, $path->token ?? null); + + // get the settings + if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null && + isset($power->guid)) + { + // set the git details in params + $path_guid = $path->guid ?? null; + if ($path_guid !== null) + { + // get the Settings meta + if (($meta = $this->contents->metadata($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null && + isset($meta->sha)) + { + if (isset($power->params) && is_object($power->params) && + isset($power->params->source) && is_array($power->params->source)) + { + $power->params->source[$path_guid . '-settings'] = $meta->sha; + } + else + { + $power->params = (object) [ + 'source' => [$path_guid . '-settings' => $meta->sha] + ]; + } + } + // get the README meta + if (($meta = $this->contents->metadata($path->organisation, $path->repository, $path->index->{$guid}->path . '/README.md', $branch)) !== null && + isset($meta->sha)) + { + if (isset($power->params) && is_object($power->params) && + isset($power->params->source) && is_array($power->params->source)) + { + $power->params->source[$path_guid . '-readme'] = $meta->sha; + } + else + { + $power->params = (object) [ + 'source' => [$path_guid . '-readme' => $meta->sha] + ]; + } + } + } + } + + // reset back to the global base and token + $this->contents->reset_(); + + return $power; + } + + /** + * Set repository messages and errors based on given conditions. + * + * @param string $message The message to set (if error) + * @param string $path Path value + * @param string $repository Repository name + * @param string $organisation Organisation name + * @param string|null $base Base URL + * + * @return void + * @since 5.0.3 + */ + protected function setRemoteIndexMessage(string $message, string $path, string $repository, string $organisation, ?string $base): void + { + $this->app->enqueueMessage( + Text::sprintf('COM_COMPONENTBUILDER_PJOOMLA_FIELD_TYPEB_REPOSITORY_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $this->contents->api(), $path, $message), + 'Error' + ); + } +} + diff --git a/src/d8d35836-60f2-4464-a306-097f079c4f13/code.power b/src/d8d35836-60f2-4464-a306-097f079c4f13/code.power new file mode 100644 index 0000000..62eb596 --- /dev/null +++ b/src/d8d35836-60f2-4464-a306-097f079c4f13/code.power @@ -0,0 +1,118 @@ + /** + * Order of global search + * + * @var array + * @since 5.0.3 + **/ + protected array $order = ['remote']; + + /** + * Search for a remote item + * + * @param string $guid The global unique id of the item + * + * @return object|null + * @since 5.0.3 + */ + protected function searchRemote(string $guid): ?object + { + // check if it exists remotely + if (($path = $this->existsRemotely($guid)) !== null) + { + return $this->getRemote($path, $guid); + } + + return null; + } + + /** + * Get a remote joomla power + * + * @param object $path The repository path details + * @param string $guid The global unique id of the power + * + * @return object|null + * @since 5.0.3 + */ + protected function getRemote(object $path, string $guid): ?object + { + $power = null; + if (empty($path->index->{$guid}->path)) + { + return $power; + } + + // get the branch name + $branch = $this->getBranchName($path); + + // load the base and token if set + $this->contents->load_($path->base ?? null, $path->token ?? null); + + // get the settings + if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null && + isset($power->guid)) + { + // set the git details in params + $path_guid = $path->guid ?? null; + if ($path_guid !== null) + { + // get the Settings meta + if (($meta = $this->contents->metadata($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null && + isset($meta->sha)) + { + if (isset($power->params) && is_object($power->params) && + isset($power->params->source) && is_array($power->params->source)) + { + $power->params->source[$path_guid . '-settings'] = $meta->sha; + } + else + { + $power->params = (object) [ + 'source' => [$path_guid . '-settings' => $meta->sha] + ]; + } + } + // get the README meta + if (($meta = $this->contents->metadata($path->organisation, $path->repository, $path->index->{$guid}->path . '/README.md', $branch)) !== null && + isset($meta->sha)) + { + if (isset($power->params) && is_object($power->params) && + isset($power->params->source) && is_array($power->params->source)) + { + $power->params->source[$path_guid . '-readme'] = $meta->sha; + } + else + { + $power->params = (object) [ + 'source' => [$path_guid . '-readme' => $meta->sha] + ]; + } + } + } + } + + // reset back to the global base and token + $this->contents->reset_(); + + return $power; + } + + /** + * Set repository messages and errors based on given conditions. + * + * @param string $message The message to set (if error) + * @param string $path Path value + * @param string $repository Repository name + * @param string $organisation Organisation name + * @param string|null $base Base URL + * + * @return void + * @since 5.0.3 + */ + protected function setRemoteIndexMessage(string $message, string $path, string $repository, string $organisation, ?string $base): void + { + $this->app->enqueueMessage( + Text::sprintf('

Joomla Field Type repository at %s/%s gave the following error!
%s

', $this->contents->api(), $path, $message), + 'Error' + ); + } \ No newline at end of file diff --git a/src/d8d35836-60f2-4464-a306-097f079c4f13/settings.json b/src/d8d35836-60f2-4464-a306-097f079c4f13/settings.json new file mode 100644 index 0000000..d3a9fd2 --- /dev/null +++ b/src/d8d35836-60f2-4464-a306-097f079c4f13/settings.json @@ -0,0 +1,21 @@ +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "1401a167-0ce4-4f4a-afee-2d8b02ed339b", + "guid": "d8d35836-60f2-4464-a306-097f079c4f13", + "implements": [ + "c182506a-ab84-439c-b962-1e606b58d545" + ], + "load_selection": null, + "name": "Grep", + "power_version": "1.0.0", + "system_name": "JCB.Fieldtype.Grep", + "type": "final class", + "use_selection": null, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Fieldtype.Grep", + "description": "Global Resource Empowerment Platform\r\n\r\n The Grep feature will try to find your joomla power in the repositories listed in the global\r\n Options of JCB in the super powers tab, and if it can't be found there will try the global core\r\n Super powers of JCB. All searches are performed according the [algorithm:cascading]\r\n See documentation for more details: https:\/\/git.vdm.dev\/joomla\/super-powers\/wiki\r\n\r\n@since 5.0.3", + "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\\Language\\Text;", + "composer": "" +} \ No newline at end of file diff --git a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.php b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.php index 3a4cf02..eae8ca0 100644 --- a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.php +++ b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.php @@ -42,6 +42,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Service\Utilities; use VDM\Joomla\Componentbuilder\Compiler\Service\BuilderAJ; use VDM\Joomla\Componentbuilder\Compiler\Service\BuilderLZ; use VDM\Joomla\Componentbuilder\Compiler\Service\Creator; +use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitectureComHelperClass; use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitectureController; use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitectureModel; use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitecturePlugin; @@ -142,6 +143,7 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface ->registerServiceProvider(new BuilderAJ()) ->registerServiceProvider(new BuilderLZ()) ->registerServiceProvider(new Creator()) + ->registerServiceProvider(new ArchitectureComHelperClass()) ->registerServiceProvider(new ArchitectureController()) ->registerServiceProvider(new ArchitectureModel()) ->registerServiceProvider(new ArchitecturePlugin()) diff --git a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.power b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.power index 812b6f7..84437f0 100644 --- a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.power +++ b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.power @@ -73,6 +73,7 @@ ->registerServiceProvider(new BuilderAJ()) ->registerServiceProvider(new BuilderLZ()) ->registerServiceProvider(new Creator()) + ->registerServiceProvider(new ArchitectureComHelperClass()) ->registerServiceProvider(new ArchitectureController()) ->registerServiceProvider(new ArchitectureModel()) ->registerServiceProvider(new ArchitecturePlugin()) diff --git a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/settings.json b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/settings.json index 0459361..b3ed086 100644 --- a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/settings.json +++ b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/settings.json @@ -128,6 +128,10 @@ "use": "8fdd604f-53e7-4a91-9935-afcfd2f6ac1b", "as": "default" }, + "use_selection43": { + "use": "8cd3c4aa-8daf-4e40-a943-456f46112c7b", + "as": "default" + }, "use_selection29": { "use": "56ba30f5-a5c4-4c4c-be6f-a56f7f9cbc60", "as": "default" @@ -136,51 +140,51 @@ "use": "bbd36fbf-d905-47e8-8e67-9ea6ec734712", "as": "default" }, - "use_selection42": { + "use_selection31": { "use": "98ac432d-df19-4c40-bb12-8104ea4362c8", "as": "default" }, - "use_selection31": { + "use_selection32": { "use": "71acf8d6-32b8-4173-8277-eb9cda29fd64", "as": "default" }, - "use_selection32": { + "use_selection33": { "use": "6edf0cf3-c2b0-45c9-84d2-c6ef1c5d434c", "as": "GiteaUtilities" }, - "use_selection33": { + "use_selection34": { "use": "f4d00907-c94a-49b7-8727-d64c1fa74cf5", "as": "GiteaSettings" }, - "use_selection34": { + "use_selection35": { "use": "3d25ea99-4f33-489a-934c-0e42027e6114", "as": "GiteaOrg" }, - "use_selection35": { + "use_selection36": { "use": "0a69cfc5-3223-4afb-8c9a-75f4bacf3c0e", "as": "GiteaUser" }, - "use_selection36": { + "use_selection37": { "use": "0bb2b72f-ebcd-46fe-844b-ac5fe715c230", "as": "GiteaRepo" }, - "use_selection37": { + "use_selection38": { "use": "808da4eb-b467-46cf-a767-e7e714f46b5a", "as": "GiteaPackage" }, - "use_selection38": { + "use_selection39": { "use": "44396eb8-e14c-47d9-9bdc-8205c0fd2bba", "as": "GiteaIssue" }, - "use_selection39": { + "use_selection40": { "use": "be57f70f-1214-4d69-8d33-7cd4e312ff70", "as": "GiteNotifi" }, - "use_selection40": { + "use_selection41": { "use": "012af7d0-3436-4cae-b856-be49bdc39a3e", "as": "GiteaMisc" }, - "use_selection41": { + "use_selection42": { "use": "ddced4c5-667d-4559-873d-d716c17fd85b", "as": "GiteaAdmin" } diff --git a/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/README.md b/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/README.md index 754b415..c5aed3a 100644 --- a/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/README.md +++ b/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/README.md @@ -19,6 +19,7 @@ class Extension << (F,LightGreen) >> #RoyalBlue { + get(object $plugin) : string # addNeededMethods(string $code) : bool # addGetSubscribedEvents(array $methods) : ?string + # validEventName(array $method) : bool # getSubscribedEvents(array $methods) : bool } @@ -57,6 +58,16 @@ note right of Extension::addGetSubscribedEvents return: ?string end note +note right of Extension::validEventName + Validates if a method name is a valid event name for a Joomla plugin. +The method must meet the following criteria: +- It must be public, not static, and not abstract. +- It must not be a magic method (i.e., should not start with '__'). + + since: 5.0.2 + return: bool +end note + note right of Extension::getSubscribedEvents Check if the getSubscribedEvents is set diff --git a/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/code.php b/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/code.php index 777087c..b8066e0 100644 --- a/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/code.php +++ b/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/code.php @@ -155,7 +155,7 @@ final class Extension implements ExtensionInterface $counter = 0; foreach ($methods as $method) { - if ($method['access'] === 'public' && !$method['static'] && !$method['abstract']) + if ($this->validEventName($method)) { $events[$method['name']] = Indent::_(3) . "'{$method['name']}' => '{$method['name']}'"; @@ -191,6 +191,37 @@ final class Extension implements ExtensionInterface return implode(PHP_EOL, $method); } + /** + * Validates if a method name is a valid event name for a Joomla plugin. + * + * The method must meet the following criteria: + * - It must be public, not static, and not abstract. + * - It must not be a magic method (i.e., should not start with '__'). + * + * @param array $method The method details, including 'name', 'access', 'static', and 'abstract'. + * + * @return bool Returns true if the method is a valid event name, otherwise false. + * + * @since 5.0.2 + */ + protected function validEventName(array $method): bool + { + // Check if the method is public, static, and not abstract + if ($method['access'] !== 'public' || $method['static'] || $method['abstract']) + { + return false; + } + + // Check if the method is a magic method (starts with '__') + if (substr($method['name'], 0, 2) === '__') + { + return false; + } + + // If all checks pass, the method is a valid event name + return true; + } + /** * Check if the getSubscribedEvents is set * diff --git a/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/code.power b/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/code.power index a70193c..cec6009 100644 --- a/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/code.power +++ b/src/ec808f55-6703-46c0-8a6d-33c9d4e0e9fa/code.power @@ -127,7 +127,7 @@ $counter = 0; foreach ($methods as $method) { - if ($method['access'] === 'public' && !$method['static'] && !$method['abstract']) + if ($this->validEventName($method)) { $events[$method['name']] = Indent::_(3) . "'{$method['name']}' => '{$method['name']}'"; @@ -163,6 +163,37 @@ return implode(PHP_EOL, $method); } + /** + * Validates if a method name is a valid event name for a Joomla plugin. + * + * The method must meet the following criteria: + * - It must be public, not static, and not abstract. + * - It must not be a magic method (i.e., should not start with '__'). + * + * @param array $method The method details, including 'name', 'access', 'static', and 'abstract'. + * + * @return bool Returns true if the method is a valid event name, otherwise false. + * + * @since 5.0.2 + */ + protected function validEventName(array $method): bool + { + // Check if the method is public, static, and not abstract + if ($method['access'] !== 'public' || $method['static'] || $method['abstract']) + { + return false; + } + + // Check if the method is a magic method (starts with '__') + if (substr($method['name'], 0, 2) === '__') + { + return false; + } + + // If all checks pass, the method is a valid event name + return true; + } + /** * Check if the getSubscribedEvents is set * diff --git a/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/README.md b/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/README.md new file mode 100644 index 0000000..ec84b0a --- /dev/null +++ b/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/README.md @@ -0,0 +1,55 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class CreateUser (Details) +> namespace: **VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\ComHelperClass** + +```uml +@startuml +class CreateUser << (F,LightGreen) >> #RoyalBlue { + + get($add) : string +} + +note right of CreateUser::get + Generates the method definition for creating or updating a user based on the provided parameters. +This method returns a string representation of a PHP function that includes various +steps for handling user creation and updates, depending on the mode (site registration or admin registration). +If true, the method will be generated and returned as a string. +Returns an empty string if $add is false. + + return: string +end note + +@enduml +``` + +The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you. + +By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component. + +JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability. + +To add this specific Power to your project in JCB: + +> simply use this SPK +``` +Super---ecf774ca_82d9_42e1_a1b5_903c6ca9efe3---Power +``` +> remember to replace the `---` with `___` to activate this Power in your code + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/code.php b/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/code.php new file mode 100644 index 0000000..42115dc --- /dev/null +++ b/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/code.php @@ -0,0 +1,125 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\ComHelperClass; + + +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent; +use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line; +use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface; + + +/** + * Helper Class Create User Class for Joomla 4 + * + * @since 5.0.2 + */ +final class CreateUser implements CreateUserInterface +{ + /** + * Generates the method definition for creating or updating a user based on the provided parameters. + * + * This method returns a string representation of a PHP function that includes various + * steps for handling user creation and updates, depending on the mode (site registration or admin registration). + * + * @param $add Determines whether to generate the user creation method or not. + * If true, the method will be generated and returned as a string. + * + * @return string The generated method code as a string if $add is true. + * Returns an empty string if $add is false. + */ + public function get($add): string + { + if ($add) + { + $method = []; + $method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Save user details by either creating a new user or updating an existing user."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) + . " * @param array \$credentials ['name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string]"; + $method[] = Indent::_(1) . " * @param int \$autologin"; + $method[] = Indent::_(1) + . " * @param array \$params ['useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int]"; + $method[] = Indent::_(1) + . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @return int User ID on success"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @throws \InvalidArgumentException If required credentials are missing."; + $method[] = Indent::_(1) . " * @throws \RuntimeException If the user update or creation fails."; + $method[] = Indent::_(1) . " * @throws Super__"."_1c10a5f1_204d_4f17_ad9f_0e0684f2030d___Power If the user is not found."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);"; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function createUser(\$credentials, \$autologin = 0,"; + $method[] = Indent::_(2) . "\$params = ["; + $method[] = Indent::_(3) + . "'useractivation' => 0, 'sendpassword' => 1"; + $method[] = Indent::_(2) . "], \$mode = 1"; + $method[] = Indent::_(1) . ")"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Create a user with the UserHelper class"; + $method[] = Indent::_(2) + . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Update the given component params."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @param string|null \$option The optional extension element name."; + $method[] = Indent::_(1) . " * @param string \$target The parameter name to be updated."; + $method[] = Indent::_(1) . " * @param mixed \$value The value to set for the parameter."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);"; + $method[] = Indent::_(1) . " */"; + $method[] = PHP_EOL . Indent::_(1) + . "public static function setParams(\$option, \$target, \$value)"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Sets a parameter value for the given target in the specified option's params"; + $method[] = Indent::_(2) + . "return Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Update user details"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @param array \$userDetails Array containing user details to be updated"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @return int Updated user ID on success."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @throws \RuntimeException If user update fails."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);"; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function updateUser(\$userDetails): int"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) + . "//" . Line::_(__Line__, __Class__) + . " Update user details with the UserHelper class"; + $method[] = Indent::_(2) . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);"; + $method[] = Indent::_(1) . "}"; + + // return the help method + return implode(PHP_EOL, $method); + } + + return ''; + } +} + diff --git a/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/code.power b/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/code.power new file mode 100644 index 0000000..f2f9f37 --- /dev/null +++ b/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/code.power @@ -0,0 +1,97 @@ + /** + * Generates the method definition for creating or updating a user based on the provided parameters. + * + * This method returns a string representation of a PHP function that includes various + * steps for handling user creation and updates, depending on the mode (site registration or admin registration). + * + * @param $add Determines whether to generate the user creation method or not. + * If true, the method will be generated and returned as a string. + * + * @return string The generated method code as a string if $add is true. + * Returns an empty string if $add is false. + */ + public function get($add): string + { + if ($add) + { + $method = []; + $method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Save user details by either creating a new user or updating an existing user."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) + . " * @param array \$credentials ['name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string]"; + $method[] = Indent::_(1) . " * @param int \$autologin"; + $method[] = Indent::_(1) + . " * @param array \$params ['useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int]"; + $method[] = Indent::_(1) + . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @return int User ID on success"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @throws \InvalidArgumentException If required credentials are missing."; + $method[] = Indent::_(1) . " * @throws \RuntimeException If the user update or creation fails."; + $method[] = Indent::_(1) . " * @throws Super__"."_1c10a5f1_204d_4f17_ad9f_0e0684f2030d___Power If the user is not found."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);"; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function createUser(\$credentials, \$autologin = 0,"; + $method[] = Indent::_(2) . "\$params = ["; + $method[] = Indent::_(3) + . "'useractivation' => 0, 'sendpassword' => 1"; + $method[] = Indent::_(2) . "], \$mode = 1"; + $method[] = Indent::_(1) . ")"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Create a user with the UserHelper class"; + $method[] = Indent::_(2) + . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Update the given component params."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @param string|null \$option The optional extension element name."; + $method[] = Indent::_(1) . " * @param string \$target The parameter name to be updated."; + $method[] = Indent::_(1) . " * @param mixed \$value The value to set for the parameter."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);"; + $method[] = Indent::_(1) . " */"; + $method[] = PHP_EOL . Indent::_(1) + . "public static function setParams(\$option, \$target, \$value)"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Sets a parameter value for the given target in the specified option's params"; + $method[] = Indent::_(2) + . "return Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);"; + $method[] = Indent::_(1) . "}"; + + $method[] = PHP_EOL . Indent::_(1) . "/**"; + $method[] = Indent::_(1) . " * Update user details"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @param array \$userDetails Array containing user details to be updated"; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @return int Updated user ID on success."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @throws \RuntimeException If user update fails."; + $method[] = Indent::_(1) . " *"; + $method[] = Indent::_(1) . " * @since 3.0.0"; + $method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);"; + $method[] = Indent::_(1) . " */"; + $method[] = Indent::_(1) + . "public static function updateUser(\$userDetails): int"; + $method[] = Indent::_(1) . "{"; + $method[] = Indent::_(2) + . "//" . Line::_(__Line__, __Class__) + . " Update user details with the UserHelper class"; + $method[] = Indent::_(2) . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);"; + $method[] = Indent::_(1) . "}"; + + // return the help method + return implode(PHP_EOL, $method); + } + + return ''; + } \ No newline at end of file diff --git a/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/settings.json b/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/settings.json new file mode 100644 index 0000000..379efe6 --- /dev/null +++ b/src/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3/settings.json @@ -0,0 +1,30 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "", + "guid": "ecf774ca-82d9-42e1-a1b5-903c6ca9efe3", + "implements": [ + "5247cc17-b620-4cf3-9a1e-d0589b36ab35" + ], + "load_selection": null, + "name": "CreateUser", + "power_version": "1.0.0", + "system_name": "JCB.Architecture.J4.ComHelperClass.CreateUser", + "type": "final class", + "use_selection": { + "use_selection0": { + "use": "a68c010b-e92e-47d5-8a44-d23cfddeb6c6", + "as": "default" + }, + "use_selection1": { + "use": "4e6ff11d-bebf-42f5-8fd7-b2f882857222", + "as": "default" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Compiler.Architecture.JoomlaFour.ComHelperClass.CreateUser", + "description": "Helper Class Create User Class for Joomla 4\r\n\r\n@since 5.0.2", + "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/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php index bed16d3..8c1e61f 100644 --- a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php +++ b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php @@ -889,7 +889,26 @@ class Config extends BaseConfig */ protected function getApprovedjoomlapaths(): array { - return array_values($this->joomla_powers_init_repos); + // some defaults repos we need by JCB + $approved = $this->joomla_powers_init_repos; + + $paths = RepoHelper::get(2); // Joomla Power = 2 + + if ($paths !== null) + { + foreach ($paths as $path) + { + $owner = $path->organisation ?? null; + $repo = $path->repository ?? null; + if ($owner !== null && $repo !== null) + { + // we make sure to get only the objects + $approved = ["{$owner}.{$repo}" => $path] + $approved; + } + } + } + + return array_values($approved); } /** diff --git a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.power b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.power index 49d41dc..1c45c10 100644 --- a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.power +++ b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.power @@ -853,7 +853,26 @@ */ protected function getApprovedjoomlapaths(): array { - return array_values($this->joomla_powers_init_repos); + // some defaults repos we need by JCB + $approved = $this->joomla_powers_init_repos; + + $paths = RepoHelper::get(2); // Joomla Power = 2 + + if ($paths !== null) + { + foreach ($paths as $path) + { + $owner = $path->organisation ?? null; + $repo = $path->repository ?? null; + if ($owner !== null && $repo !== null) + { + // we make sure to get only the objects + $approved = ["{$owner}.{$repo}" => $path] + $approved; + } + } + } + + return array_values($approved); } /** diff --git a/super-powers.json b/super-powers.json index 81d53bd..106d7b3 100644 --- a/super-powers.json +++ b/super-powers.json @@ -175,6 +175,17 @@ "spk": "Super---0a524af3_f647_4f62_a422_d7d36ebe749b---Power", "guid": "0a524af3-f647-4f62-a422-d7d36ebe749b" }, + "0b02ece5-4968-4e65-bf71-5999c4d8c4aa": { + "name": "CreateUser", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Compiler\\Architecture\\JoomlaFive\\ComHelperClass", + "code": "src\/0b02ece5-4968-4e65-bf71-5999c4d8c4aa\/code.php", + "power": "src\/0b02ece5-4968-4e65-bf71-5999c4d8c4aa\/code.power", + "settings": "src\/0b02ece5-4968-4e65-bf71-5999c4d8c4aa\/settings.json", + "path": "src\/0b02ece5-4968-4e65-bf71-5999c4d8c4aa", + "spk": "Super---0b02ece5_4968_4e65_bf71_5999c4d8c4aa---Power", + "guid": "0b02ece5-4968-4e65-bf71-5999c4d8c4aa" + }, "0b0e574c-aab4-4eaf-96d8-d7210d8ed93e": { "name": "Purge", "type": "final class", @@ -934,6 +945,17 @@ "spk": "Super---3230dd65_6590_4043_9bb8_bebd6d8224b2---Power", "guid": "3230dd65-6590-4043-9bb8-bebd6d8224b2" }, + "3235d233-ba17-4a4a-9078-aeb8c8716c04": { + "name": "Get", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Fieldtype\\Remote", + "code": "src\/3235d233-ba17-4a4a-9078-aeb8c8716c04\/code.php", + "power": "src\/3235d233-ba17-4a4a-9078-aeb8c8716c04\/code.power", + "settings": "src\/3235d233-ba17-4a4a-9078-aeb8c8716c04\/settings.json", + "path": "src\/3235d233-ba17-4a4a-9078-aeb8c8716c04", + "spk": "Super---3235d233_ba17_4a4a_9078_aeb8c8716c04---Power", + "guid": "3235d233-ba17-4a4a-9078-aeb8c8716c04" + }, "324566de-0f7d-4b6e-9caf-8424d55013ae": { "name": "Structure", "type": "class", @@ -1044,6 +1066,17 @@ "spk": "Super---355bf21a_f859_4528_9110_bcd2c6d05ea7---Power", "guid": "355bf21a-f859-4528-9110-bcd2c6d05ea7" }, + "35d9a31b-2b5d-4cbb-9763-299cacc76128": { + "name": "Item", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Fieldtype\\Readme", + "code": "src\/35d9a31b-2b5d-4cbb-9763-299cacc76128\/code.php", + "power": "src\/35d9a31b-2b5d-4cbb-9763-299cacc76128\/code.power", + "settings": "src\/35d9a31b-2b5d-4cbb-9763-299cacc76128\/settings.json", + "path": "src\/35d9a31b-2b5d-4cbb-9763-299cacc76128", + "spk": "Super---35d9a31b_2b5d_4cbb_9763_299cacc76128---Power", + "guid": "35d9a31b-2b5d-4cbb-9763-299cacc76128" + }, "361e08c0-5916-4b77-b6a2-c16a769bbc40": { "name": "Data", "type": "final class", @@ -1286,6 +1319,17 @@ "spk": "Super---45652787_9085_4c67_914f_0da25ae62646---Power", "guid": "45652787-9085-4c67-914f-0da25ae62646" }, + "469608a8-72ba-4bad-8233-80a4127c72a8": { + "name": "Factory", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Fieldtype", + "code": "src\/469608a8-72ba-4bad-8233-80a4127c72a8\/code.php", + "power": "src\/469608a8-72ba-4bad-8233-80a4127c72a8\/code.power", + "settings": "src\/469608a8-72ba-4bad-8233-80a4127c72a8\/settings.json", + "path": "src\/469608a8-72ba-4bad-8233-80a4127c72a8", + "spk": "Super---469608a8_72ba_4bad_8233_80a4127c72a8---Power", + "guid": "469608a8-72ba-4bad-8233-80a4127c72a8" + }, "46b02edb-427e-4c26-a5cb-279828eb4433": { "name": "OtherJoin", "type": "final class", @@ -1374,6 +1418,17 @@ "spk": "Super---4ad7020e_39ab_49ba_977b_de6084944502---Power", "guid": "4ad7020e-39ab-49ba-977b-de6084944502" }, + "4adfb171-2580-4d57-8fbb-fb92cfd11046": { + "name": "Fieldtype", + "type": "class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Fieldtype\\Service", + "code": "src\/4adfb171-2580-4d57-8fbb-fb92cfd11046\/code.php", + "power": "src\/4adfb171-2580-4d57-8fbb-fb92cfd11046\/code.power", + "settings": "src\/4adfb171-2580-4d57-8fbb-fb92cfd11046\/settings.json", + "path": "src\/4adfb171-2580-4d57-8fbb-fb92cfd11046", + "spk": "Super---4adfb171_2580_4d57_8fbb_fb92cfd11046---Power", + "guid": "4adfb171-2580-4d57-8fbb-fb92cfd11046" + }, "4b86f62e-ce41-4325-a11a-08148807d0df": { "name": "Event", "type": "final class", @@ -1495,6 +1550,17 @@ "spk": "Super---516f93b8_5fff_41c6_aeaf_2d93180a12cc---Power", "guid": "516f93b8-5fff-41c6-aeaf-2d93180a12cc" }, + "5247cc17-b620-4cf3-9a1e-d0589b36ab35": { + "name": "CreateUserInterface", + "type": "interface", + "namespace": "VDM\\Joomla\\Componentbuilder\\Compiler\\Interfaces\\Architecture\\ComHelperClass", + "code": "src\/5247cc17-b620-4cf3-9a1e-d0589b36ab35\/code.php", + "power": "src\/5247cc17-b620-4cf3-9a1e-d0589b36ab35\/code.power", + "settings": "src\/5247cc17-b620-4cf3-9a1e-d0589b36ab35\/settings.json", + "path": "src\/5247cc17-b620-4cf3-9a1e-d0589b36ab35", + "spk": "Super---5247cc17_b620_4cf3_9a1e_d0589b36ab35---Power", + "guid": "5247cc17-b620-4cf3-9a1e-d0589b36ab35" + }, "52de0ac8-bb9d-4a45-bd2a-a44c48c17ffe": { "name": "SiteFields", "type": "final class", @@ -2375,6 +2441,17 @@ "spk": "Super---8c018533_e967_4bf2_9bd9_9e92966fcb5e---Power", "guid": "8c018533-e967-4bf2-9bd9-9e92966fcb5e" }, + "8c7abe76-516e-4c4f-97c1-244ca43b7726": { + "name": "CreateUser", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Compiler\\Architecture\\JoomlaThree\\ComHelperClass", + "code": "src\/8c7abe76-516e-4c4f-97c1-244ca43b7726\/code.php", + "power": "src\/8c7abe76-516e-4c4f-97c1-244ca43b7726\/code.power", + "settings": "src\/8c7abe76-516e-4c4f-97c1-244ca43b7726\/settings.json", + "path": "src\/8c7abe76-516e-4c4f-97c1-244ca43b7726", + "spk": "Super---8c7abe76_516e_4c4f_97c1_244ca43b7726---Power", + "guid": "8c7abe76-516e-4c4f-97c1-244ca43b7726" + }, "8ca30d59-e56a-4cdd-bd8c-d9aad28f5903": { "name": "Tags", "type": "final class", @@ -2397,6 +2474,17 @@ "spk": "Super---8cc85656_a925_4a46_a49b_83c72167fd6a---Power", "guid": "8cc85656-a925-4a46-a49b-83c72167fd6a" }, + "8cd3c4aa-8daf-4e40-a943-456f46112c7b": { + "name": "ArchitectureComHelperClass", + "type": "class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Compiler\\Service", + "code": "src\/8cd3c4aa-8daf-4e40-a943-456f46112c7b\/code.php", + "power": "src\/8cd3c4aa-8daf-4e40-a943-456f46112c7b\/code.power", + "settings": "src\/8cd3c4aa-8daf-4e40-a943-456f46112c7b\/settings.json", + "path": "src\/8cd3c4aa-8daf-4e40-a943-456f46112c7b", + "spk": "Super---8cd3c4aa_8daf_4e40_a943_456f46112c7b---Power", + "guid": "8cd3c4aa-8daf-4e40-a943-456f46112c7b" + }, "8eee7df5-2775-41a9-9372-c46c5939a252": { "name": "Language", "type": "final class", @@ -2474,6 +2562,17 @@ "spk": "Super---914db7f5_82d8_4d3b_a1c1_eb476b1898c2---Power", "guid": "914db7f5-82d8-4d3b-a1c1-eb476b1898c2" }, + "927fc3eb-9332-43ec-b903-ce16dcf6df09": { + "name": "Main", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Fieldtype\\Readme", + "code": "src\/927fc3eb-9332-43ec-b903-ce16dcf6df09\/code.php", + "power": "src\/927fc3eb-9332-43ec-b903-ce16dcf6df09\/code.power", + "settings": "src\/927fc3eb-9332-43ec-b903-ce16dcf6df09\/settings.json", + "path": "src\/927fc3eb-9332-43ec-b903-ce16dcf6df09", + "spk": "Super---927fc3eb_9332_43ec_b903_ce16dcf6df09---Power", + "guid": "927fc3eb-9332-43ec-b903-ce16dcf6df09" + }, "92cc3144-1d3d-45b2-b49f-c7d356950033": { "name": "Customtabs", "type": "final class", @@ -3244,6 +3343,17 @@ "spk": "Super---b9f05dc4_d23a_499a_a826_9749b81818ed---Power", "guid": "b9f05dc4-d23a-499a-a826-9749b81818ed" }, + "baf83354-0be5-410e-80f9-2b64b052e482": { + "name": "Config", + "type": "class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Fieldtype", + "code": "src\/baf83354-0be5-410e-80f9-2b64b052e482\/code.php", + "power": "src\/baf83354-0be5-410e-80f9-2b64b052e482\/code.power", + "settings": "src\/baf83354-0be5-410e-80f9-2b64b052e482\/settings.json", + "path": "src\/baf83354-0be5-410e-80f9-2b64b052e482", + "spk": "Super---baf83354_0be5_410e_80f9_2b64b052e482---Power", + "guid": "baf83354-0be5-410e-80f9-2b64b052e482" + }, "bb26cf63-69a5-4c43-b2df-43284c9d907d": { "name": "JsonString", "type": "final class", @@ -3706,6 +3816,17 @@ "spk": "Super---d44f3294_6b68_4d85_a617_15fb772b7d14---Power", "guid": "d44f3294-6b68-4d85-a617-15fb772b7d14" }, + "d45b9f58-e4d7-4b0a-be05-e34c6fa215c8": { + "name": "Set", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Fieldtype\\Remote", + "code": "src\/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8\/code.php", + "power": "src\/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8\/code.power", + "settings": "src\/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8\/settings.json", + "path": "src\/d45b9f58-e4d7-4b0a-be05-e34c6fa215c8", + "spk": "Super---d45b9f58_e4d7_4b0a_be05_e34c6fa215c8---Power", + "guid": "d45b9f58-e4d7-4b0a-be05-e34c6fa215c8" + }, "d4b418a7-bf9b-4768-969d-e07c36916fd2": { "name": "Sql", "type": "class", @@ -3783,6 +3904,17 @@ "spk": "Super---d80e58b8_8462_47c4_9dcd_380445f1c64a---Power", "guid": "d80e58b8-8462-47c4-9dcd-380445f1c64a" }, + "d8d35836-60f2-4464-a306-097f079c4f13": { + "name": "Grep", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Fieldtype", + "code": "src\/d8d35836-60f2-4464-a306-097f079c4f13\/code.php", + "power": "src\/d8d35836-60f2-4464-a306-097f079c4f13\/code.power", + "settings": "src\/d8d35836-60f2-4464-a306-097f079c4f13\/settings.json", + "path": "src\/d8d35836-60f2-4464-a306-097f079c4f13", + "spk": "Super---d8d35836_60f2_4464_a306_097f079c4f13---Power", + "guid": "d8d35836-60f2-4464-a306-097f079c4f13" + }, "d8e46d2c-d63e-4b92-80a2-d17638a7ae9e": { "name": "SelectionTranslation", "type": "final class", @@ -4157,6 +4289,17 @@ "spk": "Super---ec808f55_6703_46c0_8a6d_33c9d4e0e9fa---Power", "guid": "ec808f55-6703-46c0-8a6d-33c9d4e0e9fa" }, + "ecf774ca-82d9-42e1-a1b5-903c6ca9efe3": { + "name": "CreateUser", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Compiler\\Architecture\\JoomlaFour\\ComHelperClass", + "code": "src\/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3\/code.php", + "power": "src\/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3\/code.power", + "settings": "src\/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3\/settings.json", + "path": "src\/ecf774ca-82d9-42e1-a1b5-903c6ca9efe3", + "spk": "Super---ecf774ca_82d9_42e1_a1b5_903c6ca9efe3---Power", + "guid": "ecf774ca-82d9-42e1-a1b5-903c6ca9efe3" + }, "ed314bd8-c995-4282-bcaa-5e0a68ac401b": { "name": "ConfigFieldsetsCustomfield", "type": "final class",