Compare commits

...

16 Commits
master ... dev

Author SHA1 Message Date
Robot 42310f5d44
update 2024-04-29 11:28:11 2024-04-29 11:28:11 +02:00
Robot 37ad7da5ad
update 2024-04-27 15:33:41 2024-04-27 15:33:41 +02:00
Robot 5e42dd1f70
update 2024-04-25 17:46:59 2024-04-25 17:47:04 +02:00
Robot de1a49f601
update 2024-04-25 16:46:58 2024-04-25 16:46:58 +02:00
Robot 0c98ab5bb5
update 2024-04-24 21:22:23 2024-04-24 21:22:23 +02:00
Robot c9c9e1f3d3
update 2024-04-22 00:47:33 2024-04-22 00:47:33 +02:00
Robot 4134cff484
update 2024-04-20 20:05:37 2024-04-20 20:05:38 +02:00
Robot 3bdd6c6667
update 2024-04-18 14:43:56 2024-04-18 14:43:56 +02:00
Robot 4bbcb6c3d6
update 2024-04-17 10:40:23 2024-04-17 10:40:24 +02:00
Robot 41aa3a166c
update 2024-04-16 17:05:43 2024-04-16 17:05:43 +02:00
Robot e328ad5ce3
update 2024-04-16 16:05:26 2024-04-16 16:05:26 +02:00
Robot a39b1880d9
update 2024-04-15 06:03:20 2024-04-15 06:03:20 +02:00
Robot 6748fd95ed
update 2024-04-13 20:01:28 2024-04-13 20:01:28 +02:00
Robot cd0cb2ba43
update 2024-04-13 19:01:25 2024-04-13 19:01:25 +02:00
Robot 668c954e00
update 2024-04-12 19:17:27 2024-04-12 19:17:32 +02:00
Robot 4441974faa
update 2024-04-12 17:17:01 2024-04-12 17:17:05 +02:00
176 changed files with 7306 additions and 701 deletions

View File

@ -30,6 +30,7 @@ This repository contains an index (see below) of all the approved powers within
- **abstract class Factory** | [Details](src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac) | [Code](src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.php) | [Settings](src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/settings.json) | Super__d910d8b8_4c23_4f3e_8cda_438f2d2bd7ac__Power
- **final class Component** | [Details](src/e2472b22-a329-44d8-b4a2-ae3ba99e17a0) | [Code](src/e2472b22-a329-44d8-b4a2-ae3ba99e17a0/code.php) | [Settings](src/e2472b22-a329-44d8-b4a2-ae3ba99e17a0/settings.json) | Super__e2472b22_a329_44d8_b4a2_ae3ba99e17a0__Power
- **final class JoomlaPower** | [Details](src/3730a000-ab64-477d-8b0f-70eaf71b517a) | [Code](src/3730a000-ab64-477d-8b0f-70eaf71b517a/code.php) | [Settings](src/3730a000-ab64-477d-8b0f-70eaf71b517a/settings.json) | Super__3730a000_ab64_477d_8b0f_70eaf71b517a__Power
- **class Config** | [Details](src/fa4bf18e-301e-42e3-91fb-6e0096c07adc) | [Code](src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php) | [Settings](src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/settings.json) | Super__fa4bf18e_301e_42e3_91fb_6e0096c07adc__Power
- **class Customcode** | [Details](src/313b43c4-98c3-4f62-9177-2d73ec8eba31) | [Code](src/313b43c4-98c3-4f62-9177-2d73ec8eba31/code.php) | [Settings](src/313b43c4-98c3-4f62-9177-2d73ec8eba31/settings.json) | Super__313b43c4_98c3_4f62_9177_2d73ec8eba31__Power
- **class Field** | [Details](src/d7ba2d5d-10b6-470d-978d-9f91ea65ee75) | [Code](src/d7ba2d5d-10b6-470d-978d-9f91ea65ee75/code.php) | [Settings](src/d7ba2d5d-10b6-470d-978d-9f91ea65ee75/settings.json) | Super__d7ba2d5d_10b6_470d_978d_9f91ea65ee75__Power
@ -40,14 +41,22 @@ This repository contains an index (see below) of all the approved powers within
- **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) | Super__81de8f57_dd9c_4a17_964f_848cd4a0743b__Power
- **interface GrepInterface** | [Details](src/c182506a-ab84-439c-b962-1e606b58d545) | [Code](src/c182506a-ab84-439c-b962-1e606b58d545/code.php) | [Settings](src/c182506a-ab84-439c-b962-1e606b58d545/settings.json) | Super__c182506a_ab84_439c_b962_1e606b58d545__Power
- **interface Serverinterface** | [Details](src/86ac0760-26f5-4746-9c7f-ce77860f80f8) | [Code](src/86ac0760-26f5-4746-9c7f-ce77860f80f8/code.php) | [Settings](src/86ac0760-26f5-4746-9c7f-ce77860f80f8/settings.json) | Super__86ac0760_26f5_4746_9c7f_ce77860f80f8__Power
- **interface SuperInterface** | [Details](src/51de80f2-2868-4c2c-8198-ef79349e9bd7) | [Code](src/51de80f2-2868-4c2c-8198-ef79349e9bd7/code.php) | [Settings](src/51de80f2-2868-4c2c-8198-ef79349e9bd7/settings.json) | Super__51de80f2_2868_4c2c_8198_ef79349e9bd7__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\JoomlaPower](#vdm-joomla-componentbuilder-joomlapower)
- **abstract class Factory** | [Details](src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400) | [Code](src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/code.php) | [Settings](src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/settings.json) | Super__6ee3dc9e_1949_4da5_a74f_d9eb7f14e400__Power
- **final class Grep** | [Details](src/355bf21a-f859-4528-9110-bcd2c6d05ea7) | [Code](src/355bf21a-f859-4528-9110-bcd2c6d05ea7/code.php) | [Settings](src/355bf21a-f859-4528-9110-bcd2c6d05ea7/settings.json) | Super__355bf21a_f859_4528_9110_bcd2c6d05ea7__Power
- **final class Super** | [Details](src/39a75870-a7f7-45fd-937d-5ba97b85b8ad) | [Code](src/39a75870-a7f7-45fd-937d-5ba97b85b8ad/code.php) | [Settings](src/39a75870-a7f7-45fd-937d-5ba97b85b8ad/settings.json) | Super__39a75870_a7f7_45fd_937d_5ba97b85b8ad__Power
- **class Config** | [Details](src/0b821bba-7503-4448-90e7-f3c1bd51dfd6) | [Code](src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.php) | [Settings](src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/settings.json) | Super__0b821bba_7503_4448_90e7_f3c1bd51dfd6__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power](#vdm-joomla-componentbuilder-power)
- **abstract class Factory** | [Details](src/a5734b9e-a72d-494c-bc72-c3bc7506015f) | [Code](src/a5734b9e-a72d-494c-bc72-c3bc7506015f/code.php) | [Settings](src/a5734b9e-a72d-494c-bc72-c3bc7506015f/settings.json) | Super__a5734b9e_a72d_494c_bc72_c3bc7506015f__Power
- **final class Generator** | [Details](src/505801ac-d3e2-44c6-a300-9a57a96170c6) | [Code](src/505801ac-d3e2-44c6-a300-9a57a96170c6/code.php) | [Settings](src/505801ac-d3e2-44c6-a300-9a57a96170c6/settings.json) | Super__505801ac_d3e2_44c6_a300_9a57a96170c6__Power
- **final class Grep** | [Details](src/6784dd52-0909-451a-a872-9a942a023c68) | [Code](src/6784dd52-0909-451a-a872-9a942a023c68/code.php) | [Settings](src/6784dd52-0909-451a-a872-9a942a023c68/settings.json) | Super__6784dd52_0909_451a_a872_9a942a023c68__Power
- **final class Super** | [Details](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff) | [Code](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff/code.php) | [Settings](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff/settings.json) | Super__3ab0eba9_f37b_4b37_aec1_2e78067f2aff__Power
- **class Config** | [Details](src/be4ccfae-65a9-401e-bdbe-637d8c226954) | [Code](src/be4ccfae-65a9-401e-bdbe-637d8c226954/code.php) | [Settings](src/be4ccfae-65a9-401e-bdbe-637d8c226954/settings.json) | Super__be4ccfae_65a9_401e_bdbe_637d8c226954__Power
- **class Grep** | [Details](src/6784dd52-0909-451a-a872-9a942a023c68) | [Code](src/6784dd52-0909-451a-a872-9a942a023c68/code.php) | [Settings](src/6784dd52-0909-451a-a872-9a942a023c68/settings.json) | Super__6784dd52_0909_451a_a872_9a942a023c68__Power
- **class Super** | [Details](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff) | [Code](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff/code.php) | [Settings](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff/settings.json) | Super__3ab0eba9_f37b_4b37_aec1_2e78067f2aff__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Service](#vdm-joomla-componentbuilder-service)
- **class CoreRules** | [Details](src/f65b52c2-593a-4c35-89d1-4a8e57a1adf0) | [Code](src/f65b52c2-593a-4c35-89d1-4a8e57a1adf0/code.php) | [Settings](src/f65b52c2-593a-4c35-89d1-4a8e57a1adf0/settings.json) | Super__f65b52c2_593a_4c35_89d1_4a8e57a1adf0__Power
@ -252,6 +261,10 @@ This repository contains an index (see below) of all the approved powers within
- **final class Event** | [Details](src/4729c2b0-f12b-4397-8d77-055d38bca98b) | [Code](src/4729c2b0-f12b-4397-8d77-055d38bca98b/code.php) | [Settings](src/4729c2b0-f12b-4397-8d77-055d38bca98b/settings.json) | Super__4729c2b0_f12b_4397_8d77_055d38bca98b__Power
- **final class Header** | [Details](src/1ee227b9-da0f-4e7b-ae66-99a9d53f6f49) | [Code](src/1ee227b9-da0f-4e7b-ae66-99a9d53f6f49/code.php) | [Settings](src/1ee227b9-da0f-4e7b-ae66-99a9d53f6f49/settings.json) | Super__1ee227b9_da0f_4e7b_ae66_99a9d53f6f49__Power
- **final class History** | [Details](src/25c7ca86-6088-4f5f-b9fe-13504779c6ba) | [Code](src/25c7ca86-6088-4f5f-b9fe-13504779c6ba/code.php) | [Settings](src/25c7ca86-6088-4f5f-b9fe-13504779c6ba/settings.json) | Super__25c7ca86_6088_4f5f_b9fe_13504779c6ba__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\JoomlaPower](#vdm-joomla-componentbuilder-compiler-joomlapower)
- **final class Extractor** | [Details](src/82505f3f-297f-4d75-a581-929ab3e93689) | [Code](src/82505f3f-297f-4d75-a581-929ab3e93689/code.php) | [Settings](src/82505f3f-297f-4d75-a581-929ab3e93689/settings.json) | Super__82505f3f_297f_4d75_a581_929ab3e93689__Power
- **final class Injector** | [Details](src/a6052fe9-0d2b-4b36-b3e7-03b47c483542) | [Code](src/a6052fe9-0d2b-4b36-b3e7-03b47c483542/code.php) | [Settings](src/a6052fe9-0d2b-4b36-b3e7-03b47c483542/settings.json) | Super__a6052fe9_0d2b_4b36_b3e7_03b47c483542__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\JoomlaThree](#vdm-joomla-componentbuilder-compiler-joomlathree)
- **final class Event** | [Details](src/4b86f62e-ce41-4325-a11a-08148807d0df) | [Code](src/4b86f62e-ce41-4325-a11a-08148807d0df/code.php) | [Settings](src/4b86f62e-ce41-4325-a11a-08148807d0df/settings.json) | Super__4b86f62e_ce41_4325_a11a_08148807d0df__Power
@ -318,11 +331,11 @@ This repository contains an index (see below) of all the approved powers within
- **class Reverse** | [Details](src/ca111518-e47c-4049-b1b2-cb010f23866f) | [Code](src/ca111518-e47c-4049-b1b2-cb010f23866f/code.php) | [Settings](src/ca111518-e47c-4049-b1b2-cb010f23866f/settings.json) | Super__ca111518_e47c_4049_b1b2_cb010f23866f__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Power](#vdm-joomla-componentbuilder-compiler-power)
- **final class Extractor** | [Details](src/eeb03266-22fd-45bb-953a-961bb6be3a54) | [Code](src/eeb03266-22fd-45bb-953a-961bb6be3a54/code.php) | [Settings](src/eeb03266-22fd-45bb-953a-961bb6be3a54/settings.json) | Super__eeb03266_22fd_45bb_953a_961bb6be3a54__Power
- **final class Injector** | [Details](src/763d137c-42bc-4282-98d8-cc5c0654985f) | [Code](src/763d137c-42bc-4282-98d8-cc5c0654985f/code.php) | [Settings](src/763d137c-42bc-4282-98d8-cc5c0654985f/settings.json) | Super__763d137c_42bc_4282_98d8_cc5c0654985f__Power
- **final class Parser** | [Details](src/95d0e03f-24fd-4412-bc2e-f0899fcc3205) | [Code](src/95d0e03f-24fd-4412-bc2e-f0899fcc3205/code.php) | [Settings](src/95d0e03f-24fd-4412-bc2e-f0899fcc3205/settings.json) | Super__95d0e03f_24fd_4412_bc2e_f0899fcc3205__Power
- **class Autoloader** | [Details](src/6e64917c-d687-4ef3-a655-811319f5a81e) | [Code](src/6e64917c-d687-4ef3-a655-811319f5a81e/code.php) | [Settings](src/6e64917c-d687-4ef3-a655-811319f5a81e/settings.json) | Super__6e64917c_d687_4ef3_a655_811319f5a81e__Power
- **class Extractor** | [Details](src/eeb03266-22fd-45bb-953a-961bb6be3a54) | [Code](src/eeb03266-22fd-45bb-953a-961bb6be3a54/code.php) | [Settings](src/eeb03266-22fd-45bb-953a-961bb6be3a54/settings.json) | Super__eeb03266_22fd_45bb_953a_961bb6be3a54__Power
- **class Infusion** | [Details](src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c) | [Code](src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c/code.php) | [Settings](src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c/settings.json) | Super__0419081e_4cb3_4c65_8c6a_ffe941fb0f1c__Power
- **class Injector** | [Details](src/763d137c-42bc-4282-98d8-cc5c0654985f) | [Code](src/763d137c-42bc-4282-98d8-cc5c0654985f/code.php) | [Settings](src/763d137c-42bc-4282-98d8-cc5c0654985f/settings.json) | Super__763d137c_42bc_4282_98d8_cc5c0654985f__Power
- **class Plantuml** | [Details](src/ff5e9e63-86d0-4691-ab59-d4b9d9154096) | [Code](src/ff5e9e63-86d0-4691-ab59-d4b9d9154096/code.php) | [Settings](src/ff5e9e63-86d0-4691-ab59-d4b9d9154096/settings.json) | Super__ff5e9e63_86d0_4691_ab59_d4b9d9154096__Power
- **class Structure** | [Details](src/324566de-0f7d-4b6e-9caf-8424d55013ae) | [Code](src/324566de-0f7d-4b6e-9caf-8424d55013ae/code.php) | [Settings](src/324566de-0f7d-4b6e-9caf-8424d55013ae/settings.json) | Super__324566de_0f7d_4b6e_9caf_8424d55013ae__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Service](#vdm-joomla-componentbuilder-compiler-service)
@ -342,6 +355,7 @@ This repository contains an index (see below) of all the approved powers within
- **class Field** | [Details](src/c6c30d66-3106-44eb-9272-b2cf7ec74613) | [Code](src/c6c30d66-3106-44eb-9272-b2cf7ec74613/code.php) | [Settings](src/c6c30d66-3106-44eb-9272-b2cf7ec74613/settings.json) | Super__c6c30d66_3106_44eb_9272_b2cf7ec74613__Power
- **class Header** | [Details](src/36d49d4a-8d0e-435f-ab4c-8f247d96fd4d) | [Code](src/36d49d4a-8d0e-435f-ab4c-8f247d96fd4d/code.php) | [Settings](src/36d49d4a-8d0e-435f-ab4c-8f247d96fd4d/settings.json) | Super__36d49d4a_8d0e_435f_ab4c_8f247d96fd4d__Power
- **class History** | [Details](src/63782f74-7b03-4745-aa40-0adf8ed4e704) | [Code](src/63782f74-7b03-4745-aa40-0adf8ed4e704/code.php) | [Settings](src/63782f74-7b03-4745-aa40-0adf8ed4e704/settings.json) | Super__63782f74_7b03_4745_aa40_0adf8ed4e704__Power
- **class JoomlaPower** | [Details](src/5716c79f-a1c9-4059-9d00-8cccb9f9e061) | [Code](src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.php) | [Settings](src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/settings.json) | Super__5716c79f_a1c9_4059_9d00_8cccb9f9e061__Power
- **class Joomlamodule** | [Details](src/295186de-5954-4a65-a4c1-2f79ef305743) | [Code](src/295186de-5954-4a65-a4c1-2f79ef305743/code.php) | [Settings](src/295186de-5954-4a65-a4c1-2f79ef305743/settings.json) | Super__295186de_5954_4a65_a4c1_2f79ef305743__Power
- **class Joomlaplugin** | [Details](src/9eba241c-af90-42dd-ae05-92ff4d8391d3) | [Code](src/9eba241c-af90-42dd-ae05-92ff4d8391d3/code.php) | [Settings](src/9eba241c-af90-42dd-ae05-92ff4d8391d3/settings.json) | Super__9eba241c_af90_42dd_ae05_92ff4d8391d3__Power
- **class Language** | [Details](src/9f00e793-86f8-4ef9-b775-a3eb129f83c0) | [Code](src/9f00e793-86f8-4ef9-b775-a3eb129f83c0/code.php) | [Settings](src/9f00e793-86f8-4ef9-b775-a3eb129f83c0/settings.json) | Super__9f00e793_86f8_4ef9_b775_a3eb129f83c0__Power
@ -371,11 +385,29 @@ 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) | 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) | 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) | Super__1efdded5_d6c8_452c_8f37_0374483a7b3f__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces\Database](#vdm-joomla-componentbuilder-interfaces-database)
- **interface InsertInterface** | [Details](src/95c02df3-fe0a-405b-b506-b7a5b8605b66) | [Code](src/95c02df3-fe0a-405b-b506-b7a5b8605b66/code.php) | [Settings](src/95c02df3-fe0a-405b-b506-b7a5b8605b66/settings.json) | Super__95c02df3_fe0a_405b_b506_b7a5b8605b66__Power
- **interface UpdateInterface** | [Details](src/69c29be3-ab25-4f56-944e-7ada6307b10c) | [Code](src/69c29be3-ab25-4f56-944e-7ada6307b10c/code.php) | [Settings](src/69c29be3-ab25-4f56-944e-7ada6307b10c/settings.json) | Super__69c29be3_ab25_4f56_944e_7ada6307b10c__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\JoomlaPower\Database](#vdm-joomla-componentbuilder-joomlapower-database)
- **final class Insert** | [Details](src/9d53d45e-9b4d-45ec-827b-4916b91c907e) | [Code](src/9d53d45e-9b4d-45ec-827b-4916b91c907e/code.php) | [Settings](src/9d53d45e-9b4d-45ec-827b-4916b91c907e/settings.json) | Super__9d53d45e_9b4d_45ec_827b_4916b91c907e__Power
- **final class Load** | [Details](src/b4ea5de3-653f-43f9-b927-4ba6456b4d0a) | [Code](src/b4ea5de3-653f-43f9-b927-4ba6456b4d0a/code.php) | [Settings](src/b4ea5de3-653f-43f9-b927-4ba6456b4d0a/settings.json) | Super__b4ea5de3_653f_43f9_b927_4ba6456b4d0a__Power
- **final class Update** | [Details](src/679473f6-3ea2-49d5-8273-1b29c8f0ad2b) | [Code](src/679473f6-3ea2-49d5-8273-1b29c8f0ad2b/code.php) | [Settings](src/679473f6-3ea2-49d5-8273-1b29c8f0ad2b/settings.json) | Super__679473f6_3ea2_49d5_8273_1b29c8f0ad2b__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\JoomlaPower\Model](#vdm-joomla-componentbuilder-joomlapower-model)
- **final class Load** | [Details](src/05744dd3-4030-4cf8-8dda-a93ab809b473) | [Code](src/05744dd3-4030-4cf8-8dda-a93ab809b473/code.php) | [Settings](src/05744dd3-4030-4cf8-8dda-a93ab809b473/settings.json) | Super__05744dd3_4030_4cf8_8dda_a93ab809b473__Power
- **final class Upsert** | [Details](src/9206082e-a3f7-472e-98b2-de90d06cbdcd) | [Code](src/9206082e-a3f7-472e-98b2-de90d06cbdcd/code.php) | [Settings](src/9206082e-a3f7-472e-98b2-de90d06cbdcd/settings.json) | Super__9206082e_a3f7_472e_98b2_de90d06cbdcd__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\JoomlaPower\Service](#vdm-joomla-componentbuilder-joomlapower-service)
- **class Database** | [Details](src/a2992a91-eec2-4957-811b-8cde22aa1438) | [Code](src/a2992a91-eec2-4957-811b-8cde22aa1438/code.php) | [Settings](src/a2992a91-eec2-4957-811b-8cde22aa1438/settings.json) | Super__a2992a91_eec2_4957_811b_8cde22aa1438__Power
- **class JoomlaPower** | [Details](src/38e1ca3e-1908-459a-be87-9f83b292058f) | [Code](src/38e1ca3e-1908-459a-be87-9f83b292058f/code.php) | [Settings](src/38e1ca3e-1908-459a-be87-9f83b292058f/settings.json) | Super__38e1ca3e_1908_459a_be87_9f83b292058f__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power\Database](#vdm-joomla-componentbuilder-power-database)
- **final class Insert** | [Details](src/380bb7a3-cdcc-4336-a699-5070cbf521a5) | [Code](src/380bb7a3-cdcc-4336-a699-5070cbf521a5/code.php) | [Settings](src/380bb7a3-cdcc-4336-a699-5070cbf521a5/settings.json) | Super__380bb7a3_cdcc_4336_a699_5070cbf521a5__Power
- **final class Load** | [Details](src/1f86db0f-e271-45df-8795-3e503ec76698) | [Code](src/1f86db0f-e271-45df-8795-3e503ec76698/code.php) | [Settings](src/1f86db0f-e271-45df-8795-3e503ec76698/settings.json) | Super__1f86db0f_e271_45df_8795_3e503ec76698__Power
- **final class Update** | [Details](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3) | [Code](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3/code.php) | [Settings](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3/settings.json) | Super__e543c123_b1d9_4a0b_83b2_a9d371da5ff3__Power
- **interface LoadInterface** | [Details](src/99786f53-64b7-4d52-95b0-5306e7386c3f) | [Code](src/99786f53-64b7-4d52-95b0-5306e7386c3f/code.php) | [Settings](src/99786f53-64b7-4d52-95b0-5306e7386c3f/settings.json) | Super__99786f53_64b7_4d52_95b0_5306e7386c3f__Power
- **class Insert** | [Details](src/380bb7a3-cdcc-4336-a699-5070cbf521a5) | [Code](src/380bb7a3-cdcc-4336-a699-5070cbf521a5/code.php) | [Settings](src/380bb7a3-cdcc-4336-a699-5070cbf521a5/settings.json) | Super__380bb7a3_cdcc_4336_a699_5070cbf521a5__Power
- **class Load** | [Details](src/1f86db0f-e271-45df-8795-3e503ec76698) | [Code](src/1f86db0f-e271-45df-8795-3e503ec76698/code.php) | [Settings](src/1f86db0f-e271-45df-8795-3e503ec76698/settings.json) | Super__1f86db0f_e271_45df_8795_3e503ec76698__Power
- **class Update** | [Details](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3) | [Code](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3/code.php) | [Settings](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3/settings.json) | Super__e543c123_b1d9_4a0b_83b2_a9d371da5ff3__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power\Generator](#vdm-joomla-componentbuilder-power-generator)
- **final class Bucket** | [Details](src/5d4278f0-7db2-498f-872a-c974bd8ce334) | [Code](src/5d4278f0-7db2-498f-872a-c974bd8ce334/code.php) | [Settings](src/5d4278f0-7db2-498f-872a-c974bd8ce334/settings.json) | Super__5d4278f0_7db2_498f_872a_c974bd8ce334__Power
@ -386,8 +418,8 @@ This repository contains an index (see below) of all the approved powers within
- **final class ServiceProviderBuilder** | [Details](src/8a2a3ee5-6ce2-4604-91e2-01f770228960) | [Code](src/8a2a3ee5-6ce2-4604-91e2-01f770228960/code.php) | [Settings](src/8a2a3ee5-6ce2-4604-91e2-01f770228960/settings.json) | Super__8a2a3ee5_6ce2_4604_91e2_01f770228960__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power\Model](#vdm-joomla-componentbuilder-power-model)
- **final class Load** | [Details](src/bb29a833-73f7-4283-9327-bc7e41f0723b) | [Code](src/bb29a833-73f7-4283-9327-bc7e41f0723b/code.php) | [Settings](src/bb29a833-73f7-4283-9327-bc7e41f0723b/settings.json) | Super__bb29a833_73f7_4283_9327_bc7e41f0723b__Power
- **final class Upsert** | [Details](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5) | [Code](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5/code.php) | [Settings](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5/settings.json) | Super__7c1fb50f_8fb1_4627_8705_6fedf7182ca5__Power
- **class Load** | [Details](src/bb29a833-73f7-4283-9327-bc7e41f0723b) | [Code](src/bb29a833-73f7-4283-9327-bc7e41f0723b/code.php) | [Settings](src/bb29a833-73f7-4283-9327-bc7e41f0723b/settings.json) | Super__bb29a833_73f7_4283_9327_bc7e41f0723b__Power
- **class Upsert** | [Details](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5) | [Code](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5/code.php) | [Settings](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5/settings.json) | Super__7c1fb50f_8fb1_4627_8705_6fedf7182ca5__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power\Service](#vdm-joomla-componentbuilder-power-service)
- **class Database** | [Details](src/7243aaf6-b76c-4391-8698-50abbfc98fbe) | [Code](src/7243aaf6-b76c-4391-8698-50abbfc98fbe/code.php) | [Settings](src/7243aaf6-b76c-4391-8698-50abbfc98fbe/settings.json) | Super__7243aaf6_b76c_4391_8698_50abbfc98fbe__Power
@ -457,6 +489,10 @@ This repository contains an index (see below) of all the approved powers within
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Interfaces\Model](#vdm-joomla-componentbuilder-compiler-interfaces-model)
- **interface CustomtabsInterface** | [Details](src/fcf42c53-0967-4c87-9699-a4d86adfdadf) | [Code](src/fcf42c53-0967-4c87-9699-a4d86adfdadf/code.php) | [Settings](src/fcf42c53-0967-4c87-9699-a4d86adfdadf/settings.json) | Super__fcf42c53_0967_4c87_9699_a4d86adfdadf__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power](#vdm-joomla-componentbuilder-compiler-interfaces-power)
- **interface ExtractorInterface** | [Details](src/c159425c-51f9-4a15-af99-f2d0c6d7aae8) | [Code](src/c159425c-51f9-4a15-af99-f2d0c6d7aae8/code.php) | [Settings](src/c159425c-51f9-4a15-af99-f2d0c6d7aae8/settings.json) | Super__c159425c_51f9_4a15_af99_f2d0c6d7aae8__Power
- **interface InjectorInterface** | [Details](src/e923311a-4058-4e81-9f67-5956fd0c627c) | [Code](src/e923311a-4058-4e81-9f67-5956fd0c627c/code.php) | [Settings](src/e923311a-4058-4e81-9f67-5956fd0c627c/settings.json) | Super__e923311a_4058_4e81_9f67_5956fd0c627c__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Model\JoomlaFive](#vdm-joomla-componentbuilder-compiler-model-joomlafive)
- **final class Customtabs** | [Details](src/92cc3144-1d3d-45b2-b49f-c7d356950033) | [Code](src/92cc3144-1d3d-45b2-b49f-c7d356950033/code.php) | [Settings](src/92cc3144-1d3d-45b2-b49f-c7d356950033/settings.json) | Super__92cc3144_1d3d_45b2_b49f_c7d356950033__Power

View File

@ -0,0 +1,38 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Load (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Model**
> extends: **ExtendingLoad**
```uml
@startuml
class Load << (F,LightGreen) >> #RoyalBlue {
# getTable() : string
}
note right of Load::getTable
Get the current active table
since: 3.2.0
return: string
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,37 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Model;
use VDM\Joomla\Interfaces\ModelInterface;
use VDM\Joomla\Componentbuilder\Power\Model\Load as ExtendingLoad;
/**
* Joomla Power Model Load
*
* @since 3.2.0
*/
final class Load extends ExtendingLoad implements ModelInterface
{
/**
* Get the current active table
*
* @return string
* @since 3.2.0
*/
protected function getTable(): string
{
return 'joomla_power';
}
}

View File

@ -0,0 +1,10 @@
/**
* Get the current active table
*
* @return string
* @since 3.2.0
*/
protected function getTable(): string
{
return 'joomla_power';
}

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "bb29a833-73f7-4283-9327-bc7e41f0723b",
"guid": "05744dd3-4030-4cf8-8dda-a93ab809b473",
"implements": [
"8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff"
],
"load_selection": null,
"name": "Load",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Model.Load",
"type": "final class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Model.Load",
"description": "Joomla Power Model Load\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,115 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# class Config (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower**
> extends: **BaseConfig**
```uml
@startuml
class Config #Gold {
# JoomlaRegistry $config
+ __construct(?Input $input = null, ?JoomlaRegistry $params = null, ...)
# getGiteatoken() : ?string
# getAddcustomgiteaurl() : int
# getCustomgiteaurl() : ?string
# getCustomgiteatoken() : ?string
# getJoomlapowerscoreorganisation() : string
# getJoomlapowersinitrepos() : array
# getTmppath() : string
# getLocaljoomlapowersrepositorypath() : string
# getApprovedjoomlapaths() : array
}
note right of Config::__construct
Constructor
since: 3.2.0
arguments:
?Input $input = null
?JoomlaRegistry $params = null
?JoomlaRegistry $config = null
end note
note left of Config::getGiteatoken
get Gitea Access Token
since: 3.2.0
return: ?string
end note
note right of Config::getAddcustomgiteaurl
get Add Custom Gitea URL
since: 3.2.0
return: int
end note
note left of Config::getCustomgiteaurl
get Custom Gitea URL
since: 3.2.0
return: ?string
end note
note right of Config::getCustomgiteatoken
get Custom Gitea Access Token
since: 3.2.0
return: ?string
end note
note left of Config::getJoomlapowerscoreorganisation
Get super power core organisation
since: 3.2.0
return: string
end note
note right of Config::getJoomlapowersinitrepos
Get Joomla power init repos
since: 3.2.0
return: array
end note
note left of Config::getTmppath
get temporary path
since: 3.2.0
return: string
end note
note right of Config::getLocaljoomlapowersrepositorypath
Get local joomla super powers repository path
since: 3.2.0
return: string
end note
note left of Config::getApprovedjoomlapaths
Get joomla power approved paths
since: 3.2.0
return: array
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,182 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower;
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\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 3.2.0
*/
class Config extends BaseConfig
{
/**
* The Global Joomla Configuration
*
* @var JoomlaRegistry
* @since 3.2.0
*/
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 3.2.0
*/
public function __construct(?Input $input = null, ?JoomlaRegistry $params = null, ?JoomlaRegistry $config = null)
{
parent::__construct($input, $params);
$this->config = $config ?: JoomlaFactory::getConfig();
}
/**
* get Gitea Access Token
*
* @return string the access token
* @since 3.2.0
*/
protected function getGiteatoken(): ?string
{
return $this->custom_gitea_token ?? $this->params->get('gitea_token');
}
/**
* get Add Custom Gitea URL
*
* @return int the add switch
* @since 3.2.0
*/
protected function getAddcustomgiteaurl(): int
{
return $this->params->get('add_custom_gitea_url', 1);
}
/**
* get Custom Gitea URL
*
* @return string the custom gitea url
* @since 3.2.0
*/
protected function getCustomgiteaurl(): ?string
{
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('custom_gitea_url');
}
return null;
}
/**
* get Custom Gitea Access Token
*
* @return string the custom access token
* @since 3.2.0
*/
protected function getCustomgiteatoken(): ?string
{
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('custom_gitea_token');
}
return null;
}
/**
* Get super power core organisation
*
* @return string The super power core organisation
* @since 3.2.0
*/
protected function getJoomlapowerscoreorganisation(): string
{
// the VDM default organisation is [joomla]
$organisation = 'joomla';
return $this->params->get('joomla_powers_core_organisation', $organisation);
}
/**
* Get Joomla power init repos
*
* @return array The init repositories on Gitea
* @since 3.2.0
*/
protected function getJoomlapowersinitrepos(): array
{
// some defaults repos we need by JCB
$repos = [];
$repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) ['owner' => $this->joomla_powers_core_organisation, 'repo' => 'joomla-powers', 'branch' => 'master'];
return $repos;
}
/**
* get temporary path
*
* @return string The temporary path
* @since 3.2.0
*/
protected function getTmppath(): string
{
// get the temporary path
return $this->config->get('tmp_path');
}
/**
* Get local joomla super powers repository path
*
* @return string The path to the local repository
* @since 3.2.0
*/
protected function getLocaljoomlapowersrepositorypath(): string
{
$default = $this->tmp_path . '/joomla_powers';
return $this->params->get('local_joomla_powers_repository_path', $default);
}
/**
* Get joomla power approved paths
*
* @return array The paths to the repositories on Gitea
* @since 3.2.0
*/
protected function getApprovedjoomlapaths(): array
{
// some defaults repos we need by JCB
$approved = $this->joomla_powers_init_repos;
return array_values($approved);
}
}

View File

@ -0,0 +1,146 @@
/**
* The Global Joomla Configuration
*
* @var JoomlaRegistry
* @since 3.2.0
*/
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 3.2.0
*/
public function __construct(?Input $input = null, ?JoomlaRegistry $params = null, ?JoomlaRegistry $config = null)
{
parent::__construct($input, $params);
$this->config = $config ?: JoomlaFactory::getConfig();
}
/**
* get Gitea Access Token
*
* @return string the access token
* @since 3.2.0
*/
protected function getGiteatoken(): ?string
{
return $this->custom_gitea_token ?? $this->params->get('gitea_token');
}
/**
* get Add Custom Gitea URL
*
* @return int the add switch
* @since 3.2.0
*/
protected function getAddcustomgiteaurl(): int
{
return $this->params->get('add_custom_gitea_url', 1);
}
/**
* get Custom Gitea URL
*
* @return string the custom gitea url
* @since 3.2.0
*/
protected function getCustomgiteaurl(): ?string
{
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('custom_gitea_url');
}
return null;
}
/**
* get Custom Gitea Access Token
*
* @return string the custom access token
* @since 3.2.0
*/
protected function getCustomgiteatoken(): ?string
{
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('custom_gitea_token');
}
return null;
}
/**
* Get super power core organisation
*
* @return string The super power core organisation
* @since 3.2.0
*/
protected function getJoomlapowerscoreorganisation(): string
{
// the VDM default organisation is [joomla]
$organisation = 'joomla';
return $this->params->get('joomla_powers_core_organisation', $organisation);
}
/**
* Get Joomla power init repos
*
* @return array The init repositories on Gitea
* @since 3.2.0
*/
protected function getJoomlapowersinitrepos(): array
{
// some defaults repos we need by JCB
$repos = [];
$repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) ['owner' => $this->joomla_powers_core_organisation, 'repo' => 'joomla-powers', 'branch' => 'master'];
return $repos;
}
/**
* get temporary path
*
* @return string The temporary path
* @since 3.2.0
*/
protected function getTmppath(): string
{
// get the temporary path
return $this->config->get('tmp_path');
}
/**
* Get local joomla super powers repository path
*
* @return string The path to the local repository
* @since 3.2.0
*/
protected function getLocaljoomlapowersrepositorypath(): string
{
$default = $this->tmp_path . '/joomla_powers';
return $this->params->get('local_joomla_powers_repository_path', $default);
}
/**
* Get joomla power approved paths
*
* @return array The paths to the repositories on Gitea
* @since 3.2.0
*/
protected function getApprovedjoomlapaths(): array
{
// some defaults repos we need by JCB
$approved = $this->joomla_powers_init_repos;
return array_values($approved);
}

View File

@ -0,0 +1,27 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "9769f3b2-17bf-4f20-b54b-3a4ebe572b36",
"guid": "0b821bba-7503-4448-90e7-f3c1bd51dfd6",
"implements": null,
"load_selection": null,
"name": "Config",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.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"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.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 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\Registry\\Registry as JoomlaRegistry;\r\nuse Joomla\\CMS\\Factory as JoomlaFactory;",
"composer": ""
}

View File

@ -6,13 +6,14 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Load (Details)
# class Load (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power\Database**
```uml
@startuml
class Load << (F,LightGreen) >> #RoyalBlue {
class Load #Gold {
# Model $model
# Database $load
# string $table
+ __construct(Model $model, Database $load)
+ value(array $keys, string $field) : mixed
+ item(array $keys) : ?object

View File

@ -12,8 +12,9 @@
namespace VDM\Joomla\Componentbuilder\Power\Database;
use VDM\Joomla\Componentbuilder\Power\Model\Load as Model;
use VDM\Joomla\Interfaces\ModelInterface as Model;
use VDM\Joomla\Database\Load as Database;
use VDM\Joomla\Componentbuilder\Power\Database\LoadInterface;
/**
@ -21,7 +22,7 @@ use VDM\Joomla\Database\Load as Database;
*
* @since 2.0.1
*/
final class Load
class Load implements LoadInterface
{
/**
* Model Load
@ -39,6 +40,14 @@ final class Load
*/
protected Database $load;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor
*
@ -74,11 +83,11 @@ final class Load
return $this->model->value(
$this->load->value(
["a.{$field}" => $field],
['a' => 'power'],
['a' => $this->table],
$this->prefix($keys)
),
$field,
'power'
$this->table
);
}
@ -101,10 +110,10 @@ final class Load
return $this->model->item(
$this->load->item(
['all' => 'a.*'],
['a' => 'power'],
['a' => $this->table],
$this->prefix($keys)
),
'power'
$this->table
);
}
@ -130,9 +139,9 @@ final class Load
{
return $this->model->items(
$this->load->items(
['all' => 'a.*'], ['a' => 'power'], $this->prefix($keys)
['all' => 'a.*'], ['a' => $this->table], $this->prefix($keys)
),
'power'
$this->table
);
}

View File

@ -14,6 +14,14 @@
*/
protected Database $load;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor
*
@ -49,11 +57,11 @@
return $this->model->value(
$this->load->value(
["a.{$field}" => $field],
['a' => 'power'],
['a' => $this->table],
$this->prefix($keys)
),
$field,
'power'
$this->table
);
}
@ -76,10 +84,10 @@
return $this->model->item(
$this->load->item(
['all' => 'a.*'],
['a' => 'power'],
['a' => $this->table],
$this->prefix($keys)
),
'power'
$this->table
);
}
@ -105,9 +113,9 @@
{
return $this->model->items(
$this->load->items(
['all' => 'a.*'], ['a' => 'power'], $this->prefix($keys)
['all' => 'a.*'], ['a' => $this->table], $this->prefix($keys)
),
'power'
$this->table
);
}

View File

@ -3,15 +3,17 @@
"add_licensing_template": "2",
"extends": "0",
"guid": "1f86db0f-e271-45df-8795-3e503ec76698",
"implements": null,
"implements": [
"99786f53-64b7-4d52-95b0-5306e7386c3f"
],
"load_selection": null,
"name": "Load",
"power_version": "1.0.0",
"system_name": "JCB.Power.Database.Load",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "bb29a833-73f7-4283-9327-bc7e41f0723b",
"use": "8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff",
"as": "Model"
},
"use_selection1": {

View File

@ -12,22 +12,24 @@
@startuml
class FileInjector << (F,LightGreen) >> #RoyalBlue {
# Power $power
+ __construct(Power $power)
# JoomlaPower $joomla
+ __construct(Power $power, JoomlaPower $joomla)
+ add(string $file, string $data, ...) : void
- openFileWithLock(string $file) : resource
- processFile(resource $actual_file, resource $temp_file, ...) : void
- truncateIfNeeded(resource $actual_file, string $data, ...) : void
- copyRemainingData(resource $actual_file, resource $temp_file, ...) : void
- injectSuperPowers(resource $actual_file) : void
- injectJoomlaPowers(resource $actual_file) : void
}
note right of FileInjector::__construct
Constructor.
since: 3.2.0
since: 3.2.1
end note
note right of FileInjector::add
note left of FileInjector::add
Inserts or replaces data in a file at a specific position.
since: 3.2.0
@ -47,7 +49,7 @@ note right of FileInjector::openFileWithLock
return: resource
end note
note right of FileInjector::processFile
note left of FileInjector::processFile
Processes the file for data insertion and copying the remaining data.
since: 3.2.0
@ -73,7 +75,7 @@ note right of FileInjector::truncateIfNeeded
int $position
end note
note right of FileInjector::copyRemainingData
note left of FileInjector::copyRemainingData
Copies the remaining data from the temporary stream to the actual file.
since: 3.2.0
@ -92,6 +94,13 @@ note right of FileInjector::injectSuperPowers
since: 3.2.0
return: void
end note
note left of FileInjector::injectJoomlaPowers
Injects Joomla powers into the file content, if found, and updates the file.
since: 3.2.1
return: void
end note
@enduml
```

View File

@ -13,6 +13,7 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Utilities;
use VDM\Joomla\Componentbuilder\Compiler\Power\Injector as Power;
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Injector as JoomlaPower;
use VDM\Joomla\Utilities\MathHelper;
@ -33,23 +34,41 @@ final class FileInjector
protected Power $power;
/**
* The pattern to get the powers
* The Joomla Injector Class.
*
* @var JoomlaPower
* @since 3.2.1
*/
protected JoomlaPower $joomla;
/**
* The power pattern to get the powers
*
* @var string
* @since 3.2.0
**/
protected string $pattern = '/Super_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
protected string $powerPattern = '/Super_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
/**
* The Joomla power pattern to get the powers
*
* @var string
* @since 3.2.1
**/
protected string $joomlaPattern = '/Joomla_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
/**
* Constructor.
*
* @param Power $power The Injector Class.
* @param Power $power The Injector Class.
* @param JoomlaPower $joomla The Joomla Injector Class.
*
* @since 3.2.0
* @since 3.2.1
*/
public function __construct(Power $power)
public function __construct(Power $power, JoomlaPower $joomla)
{
$this->power = $power;
$this->joomla = $joomla;
}
/**
@ -72,7 +91,9 @@ final class FileInjector
throw new \InvalidArgumentException('Position cannot be negative.');
}
$found_super_powers = preg_match($this->pattern, $data);
$found_joomla_powers = preg_match($this->joomlaPattern, $data);
$found_super_powers = preg_match($this->powerPattern, $data);
$actual_file = $this->openFileWithLock($file);
try
@ -85,6 +106,11 @@ final class FileInjector
$this->processFile($actual_file, $temp_file, $data, $position, $replace);
if ($found_joomla_powers)
{
$this->injectJoomlaPowers($actual_file);
}
if ($found_super_powers)
{
$this->injectSuperPowers($actual_file);
@ -207,6 +233,28 @@ final class FileInjector
ftruncate($actual_file, 0);
rewind($actual_file);
fwrite($actual_file, $power_data);
}
/**
* Injects Joomla powers into the file content, if found, and updates the file.
*
* @param resource $actual_file The file handle of the actual file.
*
* @return void
* @since 3.2.1
*/
private function injectJoomlaPowers($actual_file): void
{
rewind($actual_file);
$power_data = $this->joomla->power(
stream_get_contents($actual_file)
);
ftruncate($actual_file, 0);
rewind($actual_file);
fwrite($actual_file, $power_data);
}
}

View File

@ -7,23 +7,41 @@
protected Power $power;
/**
* The pattern to get the powers
* The Joomla Injector Class.
*
* @var JoomlaPower
* @since 3.2.1
*/
protected JoomlaPower $joomla;
/**
* The power pattern to get the powers
*
* @var string
* @since 3.2.0
**/
protected string $pattern = '/Super_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
protected string $powerPattern = '/Super_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
/**
* The Joomla power pattern to get the powers
*
* @var string
* @since 3.2.1
**/
protected string $joomlaPattern = '/Joomla_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
/**
* Constructor.
*
* @param Power $power The Injector Class.
* @param Power $power The Injector Class.
* @param JoomlaPower $joomla The Joomla Injector Class.
*
* @since 3.2.0
* @since 3.2.1
*/
public function __construct(Power $power)
public function __construct(Power $power, JoomlaPower $joomla)
{
$this->power = $power;
$this->joomla = $joomla;
}
/**
@ -46,7 +64,9 @@
throw new \InvalidArgumentException('Position cannot be negative.');
}
$found_super_powers = preg_match($this->pattern, $data);
$found_joomla_powers = preg_match($this->joomlaPattern, $data);
$found_super_powers = preg_match($this->powerPattern, $data);
$actual_file = $this->openFileWithLock($file);
try
@ -59,6 +79,11 @@
$this->processFile($actual_file, $temp_file, $data, $position, $replace);
if ($found_joomla_powers)
{
$this->injectJoomlaPowers($actual_file);
}
if ($found_super_powers)
{
$this->injectSuperPowers($actual_file);
@ -181,5 +206,27 @@
ftruncate($actual_file, 0);
rewind($actual_file);
fwrite($actual_file, $power_data);
}
/**
* Injects Joomla powers into the file content, if found, and updates the file.
*
* @param resource $actual_file The file handle of the actual file.
*
* @return void
* @since 3.2.1
*/
private function injectJoomlaPowers($actual_file): void
{
rewind($actual_file);
$power_data = $this->joomla->power(
stream_get_contents($actual_file)
);
ftruncate($actual_file, 0);
rewind($actual_file);
fwrite($actual_file, $power_data);
}

View File

@ -15,6 +15,10 @@
"as": "Power"
},
"use_selection1": {
"use": "a6052fe9-0d2b-4b36-b3e7-03b47c483542",
"as": "JoomlaPower"
},
"use_selection2": {
"use": "152c8793-8b75-4715-996a-257b9f65451c",
"as": "default"
}

View File

@ -62,7 +62,7 @@ class Placeholder implements ServiceProviderInterface
*
* @param Container $container The DI container.
*
* @return Worker
* @return Reverse
* @since 3.2.0
*/
public function getPlaceholderReverse(Container $container): Reverse
@ -72,7 +72,8 @@ class Placeholder implements ServiceProviderInterface
$container->get('Placeholder'),
$container->get('Language'),
$container->get('Language.Extractor'),
$container->get('Power.Extractor')
$container->get('Power.Extractor'),
$container->get('Joomla.Power.Extractor')
);
}
}

View File

@ -35,7 +35,7 @@
*
* @param Container $container The DI container.
*
* @return Worker
* @return Reverse
* @since 3.2.0
*/
public function getPlaceholderReverse(Container $container): Reverse
@ -45,6 +45,7 @@
$container->get('Placeholder'),
$container->get('Language'),
$container->get('Language.Extractor'),
$container->get('Power.Extractor')
$container->get('Power.Extractor'),
$container->get('Joomla.Power.Extractor')
);
}

View File

@ -19,9 +19,10 @@ class Customcode #Gold {
# Placeholder $placeholder
# Extractor $extractor
# Power $power
# JoomlaPower $joomla
# External $external
# $db
+ __construct(?Config $config = null, ?Placeholder $placeholder = null, ...)
+ __construct(Config $config, Placeholder $placeholder, ...)
+ update(string $string, int $debug) : string
+ set(string $string, int $debug, ...) : string
+ get(?array $ids = null, bool $setLang = true, ...) : bool
@ -36,11 +37,12 @@ note right of Customcode::__construct
since: 3.2.0
arguments:
?Config $config = null
?Placeholder $placeholder = null
?Extractor $extractor = null
?Power $power = null
?External $external = null
Config $config
Placeholder $placeholder
Extractor $extractor
Power $power
JoomlaPower $joomla
External $external
end note
note right of Customcode::update

View File

@ -18,6 +18,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Language\Extractor;
use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor as Power;
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Extractor as JoomlaPower;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\External;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Utilities\StringHelper;
@ -111,6 +112,14 @@ class Customcode implements CustomcodeInterface
**/
protected Power $power;
/**
* Joomla Power Extractor
*
* @var Power
* @since 3.2.0
**/
protected JoomlaPower $joomla;
/**
* Compiler Custom Code External
*
@ -129,23 +138,25 @@ class Customcode implements CustomcodeInterface
/**
* Constructor.
*
* @param Config|null $config The compiler config object.
* @param Placeholder|null $placeholder The compiler placeholder object.
* @param Extractor|null $extractor The compiler language extractor object.
* @param Power|null $power The compiler power extractor object.
* @param External|null $external The compiler external custom code object.
* @param \JDatabaseDriver $db The Database Driver object.
* @param Config $config The compiler config object.
* @param Placeholder $placeholder The compiler placeholder object.
* @param Extractor $extractor The compiler language extractor object.
* @param Power $power The compiler power extractor object.
* @param JoomlaPower $joomla The compiler joomla power extractor object.
* @param External $external The compiler external custom code object.
* @param \JDatabaseDriver $db The Database Driver object.
*
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?Placeholder $placeholder = null,
?Extractor $extractor = null, ?Power $power = null, ?External $external = null)
public function __construct(Config $config, Placeholder $placeholder,
Extractor $extractor, Power $power, JoomlaPower $joomla, External $external)
{
$this->config = $config ?: Compiler::_('Config');
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->extractor = $extractor ?: Compiler::_('Language.Extractor');
$this->power = $power ?: Compiler::_('Power.Extractor');
$this->external = $external ?: Compiler::_('Customcode.External');
$this->config = $config;
$this->placeholder = $placeholder;
$this->extractor = $extractor;
$this->power = $power;
$this->joomla = $joomla;
$this->external = $external;
$this->db = Factory::getDbo();
}
@ -170,8 +181,9 @@ class Customcode implements CustomcodeInterface
)
);
// extract any found super powers
// extract any found powers
$this->power->search($string);
$this->joomla->search($string);
}
// if debug
if ($debug)

View File

@ -76,6 +76,14 @@
**/
protected Power $power;
/**
* Joomla Power Extractor
*
* @var Power
* @since 3.2.0
**/
protected JoomlaPower $joomla;
/**
* Compiler Custom Code External
*
@ -94,23 +102,25 @@
/**
* Constructor.
*
* @param Config|null $config The compiler config object.
* @param Placeholder|null $placeholder The compiler placeholder object.
* @param Extractor|null $extractor The compiler language extractor object.
* @param Power|null $power The compiler power extractor object.
* @param External|null $external The compiler external custom code object.
* @param \JDatabaseDriver $db The Database Driver object.
* @param Config $config The compiler config object.
* @param Placeholder $placeholder The compiler placeholder object.
* @param Extractor $extractor The compiler language extractor object.
* @param Power $power The compiler power extractor object.
* @param JoomlaPower $joomla The compiler joomla power extractor object.
* @param External $external The compiler external custom code object.
* @param \JDatabaseDriver $db The Database Driver object.
*
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?Placeholder $placeholder = null,
?Extractor $extractor = null, ?Power $power = null, ?External $external = null)
public function __construct(Config $config, Placeholder $placeholder,
Extractor $extractor, Power $power, JoomlaPower $joomla, External $external)
{
$this->config = $config ?: Compiler::_('Config');
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->extractor = $extractor ?: Compiler::_('Language.Extractor');
$this->power = $power ?: Compiler::_('Power.Extractor');
$this->external = $external ?: Compiler::_('Customcode.External');
$this->config = $config;
$this->placeholder = $placeholder;
$this->extractor = $extractor;
$this->power = $power;
$this->joomla = $joomla;
$this->external = $external;
$this->db = Factory::getDbo();
}
@ -135,8 +145,9 @@
)
);
// extract any found super powers
// extract any found powers
$this->power->search($string);
$this->joomla->search($string);
}
// if debug
if ($debug)

View File

@ -12,43 +12,47 @@
"system_name": "JCB.Compiler.Customcode",
"type": "class",
"use_selection": {
"use_selection3": {
"use_selection0": {
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
"as": "Compiler"
},
"use_selection4": {
"use_selection1": {
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
"as": "default"
},
"use_selection5": {
"use_selection2": {
"use": "06453ada-e370-49f0-b262-e3f5a8ed0c2c",
"as": "default"
},
"use_selection6": {
"use_selection3": {
"use": "d33b9278-c409-4aec-a047-b72f56712391",
"as": "default"
},
"use_selection7": {
"use_selection4": {
"use": "eeb03266-22fd-45bb-953a-961bb6be3a54",
"as": "Power"
},
"use_selection8": {
"use_selection5": {
"use": "82505f3f-297f-4d75-a581-929ab3e93689",
"as": "JoomlaPower"
},
"use_selection6": {
"use": "1cef0266-99e2-40d8-919f-c2ce32226b0a",
"as": "default"
},
"use_selection9": {
"use_selection7": {
"use": "500f3a7f-c16d-4dd4-81b2-2df6776b5388",
"as": "default"
},
"use_selection1": {
"use_selection8": {
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
"as": "default"
},
"use_selection0": {
"use_selection9": {
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
"as": "default"
},
"use_selection2": {
"use_selection10": {
"use": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc",
"as": "default"
}

View File

@ -0,0 +1,62 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Grep (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower**
> extends: **ExtendingGrep**
```uml
@startuml
class Grep << (F,LightGreen) >> #RoyalBlue {
- getLocal(object $path, string $guid) : ?object
- getRemote(object $path, string $guid) : ?object
- localIndex(object $path) : void
- remoteIndex(object $path) : void
}
note right of Grep::getLocal
Get a local power
since: 3.2.0
return: ?object
end note
note right of Grep::getRemote
Get a remote power
since: 3.2.0
return: ?object
end note
note right of Grep::localIndex
Load the local repository index of powers
since: 3.2.0
return: void
end note
note right of Grep::remoteIndex
Load the remote repository index of powers
since: 3.2.0
return: void
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,146 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Componentbuilder\Interfaces\GrepInterface;
use VDM\Joomla\Componentbuilder\Power\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 the [algorithm:cascading]
* See documentation for more details: https://git.vdm.dev/joomla/super-powers/wiki
*
* @since 3.2.1
*/
final class Grep extends ExtendingGrep implements GrepInterface
{
/**
* Get a local power
*
* @param object $path The repository path details
* @param string $guid The global unique id of the power
*
* @return object|null
* @since 3.2.0
*/
private function getLocal(object $path, string $guid): ?object
{
if (empty($path->local->{$guid}->settings))
{
return null;
}
// get the settings
if (($settings = FileHelper::getContent($path->full_path . '/' . $path->local->{$guid}->settings, null)) !== null &&
JsonHelper::check($settings))
{
$power = json_decode($settings);
if (isset($power->guid))
{
return $power;
}
}
return null;
}
/**
* Get a remote power
*
* @param object $path The repository path details
* @param string $guid The global unique id of the power
*
* @return object|null
* @since 3.2.0
*/
private function getRemote(object $path, string $guid): ?object
{
if (empty($path->index->{$guid}->settings))
{
return null;
}
// get the settings
if (($power = $this->loadRemoteFile($path->owner, $path->repo, $path->index->{$guid}->settings, $path->branch)) !== null &&
isset($power->guid))
{
return $power;
}
return null;
}
/**
* Load the local repository index of powers
*
* @param object $path The repository path details
*
* @return void
* @since 3.2.0
*/
private function localIndex(object &$path)
{
if (isset($path->local) || !isset($path->full_path))
{
return;
}
if (($content = FileHelper::getContent($path->full_path . '/joomla-powers.json', null)) !== null &&
JsonHelper::check($content))
{
$path->local = json_decode($content);
return;
}
$path->local = null;
}
/**
* Load the remote repository index of powers
*
* @param object $path The repository path details
*
* @return void
* @since 3.2.0
*/
private function remoteIndex(object &$path)
{
if (isset($path->index))
{
return;
}
try
{
$path->index = $this->contents->get($path->owner, $path->repo, 'joomla-powers.json', $path->branch);
}
catch (\Exception $e)
{
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $this->contents->api(), $path->path, $e->getMessage()),
'Error'
);
$path->index = null;
}
}
}

View File

@ -0,0 +1,112 @@
/**
* Get a local power
*
* @param object $path The repository path details
* @param string $guid The global unique id of the power
*
* @return object|null
* @since 3.2.0
*/
private function getLocal(object $path, string $guid): ?object
{
if (empty($path->local->{$guid}->settings))
{
return null;
}
// get the settings
if (($settings = FileHelper::getContent($path->full_path . '/' . $path->local->{$guid}->settings, null)) !== null &&
JsonHelper::check($settings))
{
$power = json_decode($settings);
if (isset($power->guid))
{
return $power;
}
}
return null;
}
/**
* Get a remote power
*
* @param object $path The repository path details
* @param string $guid The global unique id of the power
*
* @return object|null
* @since 3.2.0
*/
private function getRemote(object $path, string $guid): ?object
{
if (empty($path->index->{$guid}->settings))
{
return null;
}
// get the settings
if (($power = $this->loadRemoteFile($path->owner, $path->repo, $path->index->{$guid}->settings, $path->branch)) !== null &&
isset($power->guid))
{
return $power;
}
return null;
}
/**
* Load the local repository index of powers
*
* @param object $path The repository path details
*
* @return void
* @since 3.2.0
*/
private function localIndex(object &$path)
{
if (isset($path->local) || !isset($path->full_path))
{
return;
}
if (($content = FileHelper::getContent($path->full_path . '/joomla-powers.json', null)) !== null &&
JsonHelper::check($content))
{
$path->local = json_decode($content);
return;
}
$path->local = null;
}
/**
* Load the remote repository index of powers
*
* @param object $path The repository path details
*
* @return void
* @since 3.2.0
*/
private function remoteIndex(object &$path)
{
if (isset($path->index))
{
return;
}
try
{
$path->index = $this->contents->get($path->owner, $path->repo, 'joomla-powers.json', $path->branch);
}
catch (\Exception $e)
{
$this->app->enqueueMessage(
Text::sprintf('<p>Super Power</b> repository at <b>%s/%s</b> gave the following error!<br />%s</p>', $this->contents->api(), $path->path, $e->getMessage()),
'Error'
);
$path->index = null;
}
}

View File

@ -0,0 +1,29 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "6784dd52-0909-451a-a872-9a942a023c68",
"guid": "355bf21a-f859-4528-9110-bcd2c6d05ea7",
"implements": [
"c182506a-ab84-439c-b962-1e606b58d545"
],
"load_selection": null,
"name": "Grep",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Grep",
"type": "final class",
"use_selection": {
"use_selection0": {
"use": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0",
"as": "default"
},
"use_selection1": {
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.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 the [algorithm:cascading]\r\n See documentation for more details: https:\/\/git.vdm.dev\/joomla\/super-powers\/wiki\r\n\r\n@since 3.2.1",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,144 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class JoomlaPower (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler**
```uml
@startuml
class JoomlaPower << (F,LightGreen) >> #RoyalBlue {
+ array $active
+ array $namespace
+ array $superpowers
# string $fixUrl
# array $state
# array $retry
# Config $config
# Placeholder $placeholder
# Customcode $customcode
# Gui $gui
# Superpower $superpower
# $db
# $app
+ __construct(Config $config, Placeholder $placeholder, ...)
+ load(array $guids) : void
+ get(string $guid, int $build) : ?object
- set(string $guid) : bool
- extractLastNameFromNamespace(string $namespace) : ?string
- removeLastNameFromNamespace(string $namespace) : string
- isPowerSet(string $guid) : bool
- isGuidValid(string $guid) : bool
- getPowerData(string $guid) : ?object
- getCleanNamespace(string $namespace) : string
- getUseNamespace(string $namespace, string $as = 'default') : string
- setSuperPowers(string $guid) : void
}
note right of JoomlaPower::__construct
Constructor.
since: 3.2.1
arguments:
Config $config
Placeholder $placeholder
Customcode $customcode
Gui $gui
Superpower $superpower
end note
note left of JoomlaPower::load
load all the powers linked to this component
since: 3.2.1
return: void
end note
note right of JoomlaPower::get
Get a power
since: 3.2.1
return: ?object
end note
note left of JoomlaPower::set
Set a power
since: 3.2.1
return: bool
end note
note right of JoomlaPower::extractLastNameFromNamespace
Extracts the last part of a namespace string, which is typically the class name.
since: 3.2.1
return: ?string
end note
note left of JoomlaPower::removeLastNameFromNamespace
Removes the last name from the namespace.
since: 3.2.1
return: string
end note
note right of JoomlaPower::isPowerSet
Check if the power is already set
since: 3.2.1
return: bool
end note
note left of JoomlaPower::isGuidValid
Validate the GUID
since: 3.2.1
return: bool
end note
note right of JoomlaPower::getPowerData
Get the power data from the database
since: 3.2.1
return: ?object
end note
note left of JoomlaPower::getCleanNamespace
Get Clean Namespace without use or ; as part of the name space
since: 3.2.1
return: string
end note
note right of JoomlaPower::getUseNamespace
Get [use Namespace\Class;]
since: 3.2.1
return: string
end note
note left of JoomlaPower::setSuperPowers
Set the super powers of this power
since: 3.2.1
return: void
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,446 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler;
use Joomla\CMS\Factory;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Language\Text;
use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
use VDM\Joomla\Componentbuilder\JoomlaPower\Super as SuperPower;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\Utilities\String\NamespaceHelper;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\PowerInterface;
/**
* Joomla Power
*
* @since 3.2.1
*/
final class JoomlaPower implements PowerInterface
{
/**
* All loaded powers
*
* @var array
* @since 3.2.1
**/
public array $active = [];
/**
* All power namespaces
*
* @var array
* @since 3.2.1
**/
public array $namespace = [];
/**
* All super powers of this build
*
* @var array
* @since 3.2.1
**/
public array $superpowers = [];
/**
* Old super powers found in the local repos
*
* @var array
* @since 3.2.1
**/
public array $old_superpowers = [];
/**
* The url to the power, if there is an error.
*
* @var string
* @since 3.2.1
**/
protected string $fixUrl;
/**
* The state of all loaded powers
*
* @var array
* @since 3.2.1
**/
protected array $state = [];
/**
* The state of retry to loaded powers
*
* @var array
* @since 3.2.1
**/
protected array $retry = [];
/**
* Compiler Config
*
* @var Config
* @since 3.2.1
**/
protected Config $config;
/**
* Compiler Placeholder
*
* @var Placeholder
* @since 3.2.1
**/
protected Placeholder $placeholder;
/**
* Compiler Customcode
*
* @var Customcode
* @since 3.2.1
**/
protected Customcode $customcode;
/**
* Compiler Customcode in Gui
*
* @var Gui
* @since 3.2.1
**/
protected Gui $gui;
/**
* The JCB Superpower class
*
* @var Superpower
* @since 3.2.1
**/
protected Superpower $superpower;
/**
* Database object to query local DB
*
* @since 3.2.1
**/
protected $db;
/**
* Database object to query local DB
*
* @since 3.2.1
**/
protected $app;
/**
* Constructor.
*
* @param Config $config The compiler config object.
* @param Placeholder $placeholder The compiler placeholder object.
* @param Customcode $customcode The compiler customcode object.
* @param Gui $gui The compiler customcode gui object.
* @param Superpower $superpower The JCB superpower object.
*
* @throws \Exception
* @since 3.2.1
*/
public function __construct(Config $config, Placeholder $placeholder,
Customcode $customcode, Gui $gui, Superpower $superpower)
{
$this->config = $config;
$this->placeholder = $placeholder;
$this->customcode = $customcode;
$this->gui = $gui;
$this->superpower = $superpower;
$this->db = Factory::getDbo();
$this->app = Factory::getApplication();
}
/**
* load all the powers linked to this component
*
* @param array $guids The global unique ids of the linked powers
*
* @return void
* @since 3.2.1
*/
public function load(array $guids)
{
if (ArrayHelper::check($guids))
{
foreach ($guids as $guid => $build)
{
$this->get($guid, $build);
}
}
}
/**
* Get a power
*
* @param string $guid The global unique id of the power
* @param int $build Force build switch (to override global switch)
*
* @return object|null
* @since 3.2.1
*/
public function get(string $guid, int $build = 0): ?object
{
if (($this->config->get('add_power', true) || $build == 1) && $this->set($guid))
{
return $this->active[$guid];
}
return null;
}
/**
* Set a power
*
* @param string $guid The global unique id of the power
*
* @return bool true on successful setting of a power
* @since 3.2.1
*/
private function set(string $guid): bool
{
// check if we have been here before
if ($this->isPowerSet($guid))
{
return $this->state[$guid];
}
elseif ($this->isGuidValid($guid))
{
// get the power data
$this->active[$guid] = $this->getPowerData($guid);
if (is_object($this->active[$guid]))
{
// make sure that in recursion we
// don't try to load this power again
// since during the load of a power we also load
// all powers linked to it
$this->state[$guid] = true;
// convert settings to an array
if (JsonHelper::check($this->active[$guid]->settings))
{
$this->active[$guid]->settings = $settings
= json_decode($this->active[$guid]->settings, true);
}
// set a target version
$joomla_version = $this->config->joomla_version;
if ($joomla_version && ArrayHelper::check($settings))
{
foreach ($settings as $namespace)
{
if ($joomla_version == $namespace['joomla_version'] ||
$namespace['joomla_version'] == 0)
{
$this->active[$guid]->namespace = $namespace['namespace'];
$this->active[$guid]->type = $namespace['type'] ?? 'class';
break;
}
}
$this->active[$guid]->class_name =
$this->extractLastNameFromNamespace($this->active[$guid]->namespace);
$this->active[$guid]->_namespace =
$this->removeLastNameFromNamespace($this->active[$guid]->namespace);
// set the approved super power values
$this->setSuperPowers($guid);
return true;
}
}
}
// we failed to get the power,
// so we raise an error message
// only if guid is valid
if ($this->isGuidValid($guid))
{
// now we search for it via the super power paths
if (empty($this->retry[$guid]) && $this->superpower->load($guid, ['remote', 'local']))
{
// we found it and it was loaded into the database
unset($this->state[$guid]);
unset($this->active[$guid]);
// we make sure that this retry only happen once! (just in-case...)
$this->retry[$guid] = true;
// so we try to load it again
return $this->set($guid);
}
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_PJOOMLA_POWER_BGUIDSB_NOT_FOUNDP', $guid),
'Error'
);
}
// let's not try again
$this->state[$guid] = false;
return false;
}
/**
* Extracts the last part of a namespace string, which is typically the class name.
*
* @param string $namespace The namespace string to extract from.
*
* @return string|null The extracted class name.
* @since 3.2.1
*/
private function extractLastNameFromNamespace(string $namespace): ?string
{
$parts = explode('\\', $namespace);
$result = end($parts);
// Remove '\\' from the beginning and end of the resulting string
$result = trim($result, '\\');
// If the resulting string is empty, return null
return empty($result) ? null : $result;
}
/**
* Removes the last name from the namespace.
*
* @param string $namespace The namespace
*
* @return string The namespace shortened
* @since 3.2.1
*/
private function removeLastNameFromNamespace(string $namespace): string
{
// Remove '\\' from the beginning and end of the resulting string
$namespace = trim($namespace, '\\');
$parts = explode('\\', $namespace);
// Remove the last part (the class name)
array_pop($parts);
// Reassemble the namespace without the class name
return implode('\\', $parts);
}
/**
* Check if the power is already set
*
* @param string $guid The global unique id of the power
*
* @return bool true if the power is already set
* @since 3.2.1
*/
private function isPowerSet(string $guid): bool
{
return isset($this->state[$guid]);
}
/**
* Validate the GUID
*
* @param string $guid The global unique id of the power
*
* @return bool true if the GUID is valid
* @since 3.2.1
*/
private function isGuidValid(string $guid): bool
{
return GuidHelper::valid($guid);
}
/**
* Get the power data from the database
*
* @param string $guid The global unique id of the power
*
* @return object|null The power data
* @since 3.2.1
*/
private function getPowerData(string $guid): ?object
{
$query = $this->db->getQuery(true);
$query->select('a.*');
$query->from('#__componentbuilder_joomla_power AS a');
$query->where($this->db->quoteName('a.guid') . ' = ' . $this->db->quote($guid));
$this->db->setQuery($query);
$this->db->execute();
if ($this->db->getNumRows())
{
return $this->db->loadObject();
}
return null;
}
/**
* Get Clean Namespace without use or ; as part of the name space
*
* @param string $namespace The actual name space
* @param bool $removeNumbers The switch to remove numbers
*
* @return string
* @since 3.2.1
*/
private function getCleanNamespace(string $namespace): string
{
// trim possible (use) or (;) or (starting or ending \) added to the namespace
return NamespaceHelper::safe(str_replace(['use ', ';'], '', $namespace));
}
/**
* Get [use Namespace\Class;]
*
* @param string $namespace The actual name space
* @param string $as The use as name (default is none)
*
* @return string
* @since 3.2.1
*/
private function getUseNamespace(string $namespace, string $as = 'default'): string
{
// check if it has an AS option
if ($as !== 'default')
{
return 'use ' . $namespace . ' as ' . $as . ';';
}
return 'use ' . $namespace . ';';
}
/**
* Set the super powers of this power
*
* @param string $guid The global unique id of the power
*
* @return void
* @since 3.2.1
*/
private function setSuperPowers(string $guid): void
{
// soon
}
}

View File

@ -0,0 +1,408 @@
/**
* All loaded powers
*
* @var array
* @since 3.2.1
**/
public array $active = [];
/**
* All power namespaces
*
* @var array
* @since 3.2.1
**/
public array $namespace = [];
/**
* All super powers of this build
*
* @var array
* @since 3.2.1
**/
public array $superpowers = [];
/**
* Old super powers found in the local repos
*
* @var array
* @since 3.2.1
**/
public array $old_superpowers = [];
/**
* The url to the power, if there is an error.
*
* @var string
* @since 3.2.1
**/
protected string $fixUrl;
/**
* The state of all loaded powers
*
* @var array
* @since 3.2.1
**/
protected array $state = [];
/**
* The state of retry to loaded powers
*
* @var array
* @since 3.2.1
**/
protected array $retry = [];
/**
* Compiler Config
*
* @var Config
* @since 3.2.1
**/
protected Config $config;
/**
* Compiler Placeholder
*
* @var Placeholder
* @since 3.2.1
**/
protected Placeholder $placeholder;
/**
* Compiler Customcode
*
* @var Customcode
* @since 3.2.1
**/
protected Customcode $customcode;
/**
* Compiler Customcode in Gui
*
* @var Gui
* @since 3.2.1
**/
protected Gui $gui;
/**
* The JCB Superpower class
*
* @var Superpower
* @since 3.2.1
**/
protected Superpower $superpower;
/**
* Database object to query local DB
*
* @since 3.2.1
**/
protected $db;
/**
* Database object to query local DB
*
* @since 3.2.1
**/
protected $app;
/**
* Constructor.
*
* @param Config $config The compiler config object.
* @param Placeholder $placeholder The compiler placeholder object.
* @param Customcode $customcode The compiler customcode object.
* @param Gui $gui The compiler customcode gui object.
* @param Superpower $superpower The JCB superpower object.
*
* @throws \Exception
* @since 3.2.1
*/
public function __construct(Config $config, Placeholder $placeholder,
Customcode $customcode, Gui $gui, Superpower $superpower)
{
$this->config = $config;
$this->placeholder = $placeholder;
$this->customcode = $customcode;
$this->gui = $gui;
$this->superpower = $superpower;
$this->db = Factory::getDbo();
$this->app = Factory::getApplication();
}
/**
* load all the powers linked to this component
*
* @param array $guids The global unique ids of the linked powers
*
* @return void
* @since 3.2.1
*/
public function load(array $guids)
{
if (ArrayHelper::check($guids))
{
foreach ($guids as $guid => $build)
{
$this->get($guid, $build);
}
}
}
/**
* Get a power
*
* @param string $guid The global unique id of the power
* @param int $build Force build switch (to override global switch)
*
* @return object|null
* @since 3.2.1
*/
public function get(string $guid, int $build = 0): ?object
{
if (($this->config->get('add_power', true) || $build == 1) && $this->set($guid))
{
return $this->active[$guid];
}
return null;
}
/**
* Set a power
*
* @param string $guid The global unique id of the power
*
* @return bool true on successful setting of a power
* @since 3.2.1
*/
private function set(string $guid): bool
{
// check if we have been here before
if ($this->isPowerSet($guid))
{
return $this->state[$guid];
}
elseif ($this->isGuidValid($guid))
{
// get the power data
$this->active[$guid] = $this->getPowerData($guid);
if (is_object($this->active[$guid]))
{
// make sure that in recursion we
// don't try to load this power again
// since during the load of a power we also load
// all powers linked to it
$this->state[$guid] = true;
// convert settings to an array
if (JsonHelper::check($this->active[$guid]->settings))
{
$this->active[$guid]->settings = $settings
= json_decode($this->active[$guid]->settings, true);
}
// set a target version
$joomla_version = $this->config->joomla_version;
if ($joomla_version && ArrayHelper::check($settings))
{
foreach ($settings as $namespace)
{
if ($joomla_version == $namespace['joomla_version'] ||
$namespace['joomla_version'] == 0)
{
$this->active[$guid]->namespace = $namespace['namespace'];
$this->active[$guid]->type = $namespace['type'] ?? 'class';
break;
}
}
$this->active[$guid]->class_name =
$this->extractLastNameFromNamespace($this->active[$guid]->namespace);
$this->active[$guid]->_namespace =
$this->removeLastNameFromNamespace($this->active[$guid]->namespace);
// set the approved super power values
$this->setSuperPowers($guid);
return true;
}
}
}
// we failed to get the power,
// so we raise an error message
// only if guid is valid
if ($this->isGuidValid($guid))
{
// now we search for it via the super power paths
if (empty($this->retry[$guid]) && $this->superpower->load($guid, ['remote', 'local']))
{
// we found it and it was loaded into the database
unset($this->state[$guid]);
unset($this->active[$guid]);
// we make sure that this retry only happen once! (just in-case...)
$this->retry[$guid] = true;
// so we try to load it again
return $this->set($guid);
}
$this->app->enqueueMessage(
Text::sprintf('<p>Joomla Power <b>guid:%s</b> not found!</p>', $guid),
'Error'
);
}
// let's not try again
$this->state[$guid] = false;
return false;
}
/**
* Extracts the last part of a namespace string, which is typically the class name.
*
* @param string $namespace The namespace string to extract from.
*
* @return string|null The extracted class name.
* @since 3.2.1
*/
private function extractLastNameFromNamespace(string $namespace): ?string
{
$parts = explode('\\', $namespace);
$result = end($parts);
// Remove '\\' from the beginning and end of the resulting string
$result = trim($result, '\\');
// If the resulting string is empty, return null
return empty($result) ? null : $result;
}
/**
* Removes the last name from the namespace.
*
* @param string $namespace The namespace
*
* @return string The namespace shortened
* @since 3.2.1
*/
private function removeLastNameFromNamespace(string $namespace): string
{
// Remove '\\' from the beginning and end of the resulting string
$namespace = trim($namespace, '\\');
$parts = explode('\\', $namespace);
// Remove the last part (the class name)
array_pop($parts);
// Reassemble the namespace without the class name
return implode('\\', $parts);
}
/**
* Check if the power is already set
*
* @param string $guid The global unique id of the power
*
* @return bool true if the power is already set
* @since 3.2.1
*/
private function isPowerSet(string $guid): bool
{
return isset($this->state[$guid]);
}
/**
* Validate the GUID
*
* @param string $guid The global unique id of the power
*
* @return bool true if the GUID is valid
* @since 3.2.1
*/
private function isGuidValid(string $guid): bool
{
return GuidHelper::valid($guid);
}
/**
* Get the power data from the database
*
* @param string $guid The global unique id of the power
*
* @return object|null The power data
* @since 3.2.1
*/
private function getPowerData(string $guid): ?object
{
$query = $this->db->getQuery(true);
$query->select('a.*');
$query->from('#__componentbuilder_joomla_power AS a');
$query->where($this->db->quoteName('a.guid') . ' = ' . $this->db->quote($guid));
$this->db->setQuery($query);
$this->db->execute();
if ($this->db->getNumRows())
{
return $this->db->loadObject();
}
return null;
}
/**
* Get Clean Namespace without use or ; as part of the name space
*
* @param string $namespace The actual name space
* @param bool $removeNumbers The switch to remove numbers
*
* @return string
* @since 3.2.1
*/
private function getCleanNamespace(string $namespace): string
{
// trim possible (use) or (;) or (starting or ending \) added to the namespace
return NamespaceHelper::safe(str_replace(['use ', ';'], '', $namespace));
}
/**
* Get [use Namespace\Class;]
*
* @param string $namespace The actual name space
* @param string $as The use as name (default is none)
*
* @return string
* @since 3.2.1
*/
private function getUseNamespace(string $namespace, string $as = 'default'): string
{
// check if it has an AS option
if ($as !== 'default')
{
return 'use ' . $namespace . ' as ' . $as . ';';
}
return 'use ' . $namespace . ';';
}
/**
* Set the super powers of this power
*
* @param string $guid The global unique id of the power
*
* @return void
* @since 3.2.1
*/
private function setSuperPowers(string $guid): void
{
// soon
}

View File

@ -0,0 +1,57 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "0",
"guid": "3730a000-ab64-477d-8b0f-70eaf71b517a",
"implements": [
"1133c2d7-ba7e-4c95-8cde-01f084d04682"
],
"load_selection": null,
"name": "JoomlaPower",
"power_version": "1.0.0",
"system_name": "JCB.Compiler.JoomlaPower",
"type": "final class",
"use_selection": {
"use_selection0": {
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
"as": "default"
},
"use_selection1": {
"use": "06453ada-e370-49f0-b262-e3f5a8ed0c2c",
"as": "default"
},
"use_selection2": {
"use": "313b43c4-98c3-4f62-9177-2d73ec8eba31",
"as": "default"
},
"use_selection3": {
"use": "1bd48df2-4f7e-4581-9fe9-4b54e59105e3",
"as": "default"
},
"use_selection4": {
"use": "39a75870-a7f7-45fd-937d-5ba97b85b8ad",
"as": "SuperPower"
},
"use_selection5": {
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
"as": "default"
},
"use_selection6": {
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
"as": "default"
},
"use_selection7": {
"use": "9c513baf-b279-43fd-ae29-a585c8cbc4f0",
"as": "default"
},
"use_selection8": {
"use": "ce8cf834-6bac-44fb-941c-861f7e046cc0",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.JoomlaPower",
"description": "Joomla Power\r\n\r\n@since 3.2.1",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\Application\\CMSApplication;\r\nuse Joomla\\CMS\\Language\\Text;",
"composer": ""
}

View File

@ -6,13 +6,14 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Insert (Details)
# class Insert (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power\Database**
```uml
@startuml
class Insert << (F,LightGreen) >> #RoyalBlue {
class Insert #Gold {
# Model $model
# Database $database
# string $table
+ __construct(Model $model, Database $database)
+ value(mixed $value, string $field, ...) : bool
+ row(array $item) : bool

View File

@ -12,8 +12,9 @@
namespace VDM\Joomla\Componentbuilder\Power\Database;
use VDM\Joomla\Componentbuilder\Power\Model\Upsert as Model;
use VDM\Joomla\Interfaces\ModelInterface as Model;
use VDM\Joomla\Database\Insert as Database;
use VDM\Joomla\Componentbuilder\Interfaces\Database\InsertInterface;
/**
@ -21,7 +22,7 @@ use VDM\Joomla\Database\Insert as Database;
*
* @since 3.2.0
*/
final class Insert
class Insert implements InsertInterface
{
/**
* Model
@ -39,6 +40,14 @@ final class Insert
*/
protected Database $database;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor
*
@ -88,10 +97,10 @@ final class Insert
public function row(array $item): bool
{
// check if object could be modelled
if (($item = $this->model->row($item, 'power')) !== null)
if (($item = $this->model->row($item, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->row($item, 'power');
return $this->database->row($item, $this->table);
}
return false;
}
@ -108,10 +117,10 @@ final class Insert
public function rows(?array $items): bool
{
// check if object could be modelled
if (($items = $this->model->rows($items, 'power')) !== null)
if (($items = $this->model->rows($items, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->rows($items, 'power');
return $this->database->rows($items, $this->table);
}
return false;
}
@ -128,10 +137,10 @@ final class Insert
public function item(object $item): bool
{
// check if object could be modelled
if (($item = $this->model->item($item, 'power')) !== null)
if (($item = $this->model->item($item, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->item($item, 'power');
return $this->database->item($item, $this->table);
}
return false;
}
@ -148,13 +157,12 @@ final class Insert
public function items(?array $items): bool
{
// check if object could be modelled
if (($items = $this->model->items($items, 'power')) !== null)
if (($items = $this->model->items($items, $this->table)) !== null)
{
// Update the column of this table using guid as the primary key.
return $this->database->items($items, 'power');
return $this->database->items($items, $this->table);
}
return false;
}
}
}

View File

@ -14,6 +14,14 @@
*/
protected Database $database;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor
*
@ -63,10 +71,10 @@
public function row(array $item): bool
{
// check if object could be modelled
if (($item = $this->model->row($item, 'power')) !== null)
if (($item = $this->model->row($item, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->row($item, 'power');
return $this->database->row($item, $this->table);
}
return false;
}
@ -83,10 +91,10 @@
public function rows(?array $items): bool
{
// check if object could be modelled
if (($items = $this->model->rows($items, 'power')) !== null)
if (($items = $this->model->rows($items, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->rows($items, 'power');
return $this->database->rows($items, $this->table);
}
return false;
}
@ -103,10 +111,10 @@
public function item(object $item): bool
{
// check if object could be modelled
if (($item = $this->model->item($item, 'power')) !== null)
if (($item = $this->model->item($item, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->item($item, 'power');
return $this->database->item($item, $this->table);
}
return false;
}
@ -123,10 +131,10 @@
public function items(?array $items): bool
{
// check if object could be modelled
if (($items = $this->model->items($items, 'power')) !== null)
if (($items = $this->model->items($items, $this->table)) !== null)
{
// Update the column of this table using guid as the primary key.
return $this->database->items($items, 'power');
return $this->database->items($items, $this->table);
}
return false;
}
}

View File

@ -3,15 +3,17 @@
"add_licensing_template": "2",
"extends": "0",
"guid": "380bb7a3-cdcc-4336-a699-5070cbf521a5",
"implements": null,
"implements": [
"95c02df3-fe0a-405b-b506-b7a5b8605b66"
],
"load_selection": null,
"name": "Insert",
"power_version": "1.0.0",
"system_name": "JCB.Power.Database.Insert",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "7c1fb50f-8fb1-4627-8705-6fedf7182ca5",
"use": "8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff",
"as": "Model"
},
"use_selection1": {

View File

@ -0,0 +1,77 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# class JoomlaPower (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Service**
```uml
@startuml
class JoomlaPower #Gold {
+ register(Container $container) : void
+ getConfig(Container $container) : Config
+ getTable(Container $container) : Table
+ getGrep(Container $container) : Grep
+ getSuperpower(Container $container) : Superpower
+ getParser(Container $container) : Parser
}
note right of JoomlaPower::register
Registers the service provider with a DI container.
since: 3.2.0
return: void
end note
note right of JoomlaPower::getConfig
Get The Config Class.
since: 3.2.0
return: Config
end note
note right of JoomlaPower::getTable
Get The Table Class.
since: 3.2.0
return: Table
end note
note right of JoomlaPower::getGrep
Get The Grep Class.
since: 3.2.0
return: Grep
end note
note right of JoomlaPower::getSuperpower
Get The Super Class.
since: 3.2.0
return: Superpower
end note
note right of JoomlaPower::getParser
Get The Parser Class.
since: 3.2.0
return: Parser
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,130 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\JoomlaPower\Config;
use VDM\Joomla\Componentbuilder\Table;
use VDM\Joomla\Componentbuilder\JoomlaPower\Grep;
use VDM\Joomla\Componentbuilder\JoomlaPower\Super as Superpower;
use VDM\Joomla\Componentbuilder\Compiler\Power\Parser;
/**
* Joomla Power Service Provider
*
* @since 3.2.1
*/
class JoomlaPower implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Config::class, 'Config')
->share('Config', [$this, 'getConfig'], true);
$container->alias(Table::class, 'Table')
->share('Table', [$this, 'getTable'], true);
$container->alias(Grep::class, 'Joomla.Power.Grep')
->share('Joomla.Power.Grep', [$this, 'getGrep'], true);
$container->alias(Superpower::class, 'Joomlapower')
->share('Joomlapower', [$this, 'getSuperpower'], true);
$container->alias(Parser::class, 'Power.Parser')
->share('Power.Parser', [$this, 'getParser'], true);
}
/**
* Get The Config Class.
*
* @param Container $container The DI container.
*
* @return Config
* @since 3.2.0
*/
public function getConfig(Container $container): Config
{
return new Config();
}
/**
* Get The Table Class.
*
* @param Container $container The DI container.
*
* @return Table
* @since 3.2.0
*/
public function getTable(Container $container): Table
{
return new Table();
}
/**
* Get The Grep Class.
*
* @param Container $container The DI container.
*
* @return Grep
* @since 3.2.0
*/
public function getGrep(Container $container): Grep
{
return new Grep(
$container->get('Config')->local_joomla_powers_repository_path,
$container->get('Config')->approved_joomla_paths,
$container->get('Gitea.Repository.Contents')
);
}
/**
* Get The Super Class.
*
* @param Container $container The DI container.
*
* @return Superpower
* @since 3.2.0
*/
public function getSuperpower(Container $container): Superpower
{
return new Superpower(
$container->get('Joomla.Power.Grep'),
$container->get('Joomla.Power.Database.Insert'),
$container->get('Joomla.Power.Database.Update')
);
}
/**
* Get The Parser Class.
*
* @param Container $container The DI container.
*
* @return Parser
* @since 3.2.0
*/
public function getParser(Container $container): Parser
{
return new Parser();
}
}

View File

@ -0,0 +1,98 @@
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Config::class, 'Config')
->share('Config', [$this, 'getConfig'], true);
$container->alias(Table::class, 'Table')
->share('Table', [$this, 'getTable'], true);
$container->alias(Grep::class, 'Joomla.Power.Grep')
->share('Joomla.Power.Grep', [$this, 'getGrep'], true);
$container->alias(Superpower::class, 'Joomlapower')
->share('Joomlapower', [$this, 'getSuperpower'], true);
$container->alias(Parser::class, 'Power.Parser')
->share('Power.Parser', [$this, 'getParser'], true);
}
/**
* Get The Config Class.
*
* @param Container $container The DI container.
*
* @return Config
* @since 3.2.0
*/
public function getConfig(Container $container): Config
{
return new Config();
}
/**
* Get The Table Class.
*
* @param Container $container The DI container.
*
* @return Table
* @since 3.2.0
*/
public function getTable(Container $container): Table
{
return new Table();
}
/**
* Get The Grep Class.
*
* @param Container $container The DI container.
*
* @return Grep
* @since 3.2.0
*/
public function getGrep(Container $container): Grep
{
return new Grep(
$container->get('Config')->local_joomla_powers_repository_path,
$container->get('Config')->approved_joomla_paths,
$container->get('Gitea.Repository.Contents')
);
}
/**
* Get The Super Class.
*
* @param Container $container The DI container.
*
* @return Superpower
* @since 3.2.0
*/
public function getSuperpower(Container $container): Superpower
{
return new Superpower(
$container->get('Joomla.Power.Grep'),
$container->get('Joomla.Power.Database.Insert'),
$container->get('Joomla.Power.Database.Update')
);
}
/**
* Get The Parser Class.
*
* @param Container $container The DI container.
*
* @return Parser
* @since 3.2.0
*/
public function getParser(Container $container): Parser
{
return new Parser();
}

View File

@ -0,0 +1,42 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "0",
"guid": "38e1ca3e-1908-459a-be87-9f83b292058f",
"implements": [
"-1"
],
"load_selection": null,
"name": "JoomlaPower",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Service.JoomlaPower",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "0b821bba-7503-4448-90e7-f3c1bd51dfd6",
"as": "default"
},
"use_selection1": {
"use": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8",
"as": "default"
},
"use_selection2": {
"use": "355bf21a-f859-4528-9110-bcd2c6d05ea7",
"as": "default"
},
"use_selection3": {
"use": "39a75870-a7f7-45fd-937d-5ba97b85b8ad",
"as": "Superpower"
},
"use_selection4": {
"use": "95d0e03f-24fd-4412-bc2e-f0899fcc3205",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Service.JoomlaPower",
"description": "Joomla Power Service Provider\r\n\r\n@since 3.2.1",
"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 <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
"composer": ""
}

View File

@ -0,0 +1,31 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Super (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower**
> extends: **ExtendingSuper**
```uml
@startuml
class Super << (F,LightGreen) >> #RoyalBlue {
# string $table
}
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower;
use VDM\Joomla\Componentbuilder\Interfaces\SuperInterface;
use VDM\Joomla\Componentbuilder\Power\Super as ExtendingSuper;
/**
* Super Joomla Power of JCB
*
* @since 3.2.0
*/
final class Super extends ExtendingSuper implements SuperInterface
{
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'joomla_power';
}

View File

@ -0,0 +1,7 @@
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'joomla_power';

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "3ab0eba9-f37b-4b37-aec1-2e78067f2aff",
"guid": "39a75870-a7f7-45fd-937d-5ba97b85b8ad",
"implements": [
"51de80f2-2868-4c2c-8198-ef79349e9bd7"
],
"load_selection": null,
"name": "Super",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Super",
"type": "final class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Super",
"description": "Super Joomla Power of JCB\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -158,28 +158,38 @@ class Data
// check if layout keys were passed
if (!ArrayHelper::check($layouts))
{
$layout_bucket = [];
// set the Layout data
$lay1 = GetHelper::allBetween(
if (($layouts_found = GetHelper::allBetween(
$content, "LayoutHelper::render('", "',"
);
$lay2 = GetHelper::allBetween(
$content, 'LayoutHelper::render("', '",'
);
if (ArrayHelper::check($lay1)
&& ArrayHelper::check($lay2))
)) !== null)
{
$layouts = array_merge($lay1, $lay2);
$layout_bucket[] = $layouts_found;
}
else
if (($layouts_found = GetHelper::allBetween(
$content, 'LayoutHelper::render("', '",'
)) !== null)
{
if (ArrayHelper::check($lay1))
{
$layouts = $lay1;
}
elseif (ArrayHelper::check($lay2))
{
$layouts = $lay2;
}
$layout_bucket[] = $layouts_found;
}
// set the Layout data
if (($layouts_found = GetHelper::allBetween(
$content, "Joomla__" . "_7ab82272_0b3d_4bb1_af35_e63a096cfe0b___Power::render('", "',"
)) !== null)
{
$layout_bucket[] = $layouts_found;
}
if (($layouts_found = GetHelper::allBetween(
$content, 'Joomla__' . '_7ab82272_0b3d_4bb1_af35_e63a096cfe0b___Power::render("', '",'
)) !== null)
{
$layout_bucket[] = $layouts_found;
}
// Flatten and merge all collected layouts if any
if ($layout_bucket !== [])
{
$layouts = array_merge($layouts, ...$layout_bucket);
}
}

View File

@ -129,28 +129,38 @@
// check if layout keys were passed
if (!ArrayHelper::check($layouts))
{
$layout_bucket = [];
// set the Layout data
$lay1 = GetHelper::allBetween(
if (($layouts_found = GetHelper::allBetween(
$content, "LayoutHelper::render('", "',"
);
$lay2 = GetHelper::allBetween(
$content, 'LayoutHelper::render("', '",'
);
if (ArrayHelper::check($lay1)
&& ArrayHelper::check($lay2))
)) !== null)
{
$layouts = array_merge($lay1, $lay2);
$layout_bucket[] = $layouts_found;
}
else
if (($layouts_found = GetHelper::allBetween(
$content, 'LayoutHelper::render("', '",'
)) !== null)
{
if (ArrayHelper::check($lay1))
{
$layouts = $lay1;
}
elseif (ArrayHelper::check($lay2))
{
$layouts = $lay2;
}
$layout_bucket[] = $layouts_found;
}
// set the Layout data
if (($layouts_found = GetHelper::allBetween(
$content, "Joomla__" . "_7ab82272_0b3d_4bb1_af35_e63a096cfe0b___Power::render('", "',"
)) !== null)
{
$layout_bucket[] = $layouts_found;
}
if (($layouts_found = GetHelper::allBetween(
$content, 'Joomla__' . '_7ab82272_0b3d_4bb1_af35_e63a096cfe0b___Power::render("', '",'
)) !== null)
{
$layout_bucket[] = $layouts_found;
}
// Flatten and merge all collected layouts if any
if ($layout_bucket !== [])
{
$layouts = array_merge($layouts, ...$layout_bucket);
}
}

View File

@ -6,14 +6,15 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Super (Details)
# class Super (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power**
```uml
@startuml
class Super << (F,LightGreen) >> #RoyalBlue {
class Super #Gold {
# Grep $grep
# Insert $insert
# Update $update
# string $table
+ __construct(Grep $grep, Insert $insert, ...)
+ init() : bool
+ reset(array $powers) : bool

View File

@ -12,10 +12,11 @@
namespace VDM\Joomla\Componentbuilder\Power;
use VDM\Joomla\Componentbuilder\Power\Grep;
use VDM\Joomla\Componentbuilder\Power\Database\Insert;
use VDM\Joomla\Componentbuilder\Power\Database\Update;
use VDM\Joomla\Componentbuilder\Interfaces\GrepInterface as Grep;
use VDM\Joomla\Componentbuilder\Interfaces\Database\InsertInterface as Insert;
use VDM\Joomla\Componentbuilder\Interfaces\Database\UpdateInterface as Update;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\Componentbuilder\Interfaces\SuperInterface;
/**
@ -23,7 +24,7 @@ use VDM\Joomla\Utilities\GuidHelper;
*
* @since 3.2.0
*/
final class Super
class Super implements SuperInterface
{
/**
* The Power Search Tool
@ -49,6 +50,14 @@ final class Super
**/
protected Update $update;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor.
*
@ -174,7 +183,7 @@ final class Super
*/
private function action(string $guid): string
{
if (($id = GuidHelper::item($guid, 'power')) !== null && $id > 0)
if (($id = GuidHelper::item($guid, $this->table)) !== null && $id > 0)
{
return 'update';
}

View File

@ -22,6 +22,14 @@
**/
protected Update $update;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor.
*
@ -147,7 +155,7 @@
*/
private function action(string $guid): string
{
if (($id = GuidHelper::item($guid, 'power')) !== null && $id > 0)
if (($id = GuidHelper::item($guid, $this->table)) !== null && $id > 0)
{
return 'update';
}

View File

@ -3,24 +3,26 @@
"add_licensing_template": "2",
"extends": "0",
"guid": "3ab0eba9-f37b-4b37-aec1-2e78067f2aff",
"implements": null,
"implements": [
"51de80f2-2868-4c2c-8198-ef79349e9bd7"
],
"load_selection": null,
"name": "Super",
"power_version": "1.0.0",
"system_name": "JCB.Power.Super",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "6784dd52-0909-451a-a872-9a942a023c68",
"as": "default"
"use": "c182506a-ab84-439c-b962-1e606b58d545",
"as": "Grep"
},
"use_selection1": {
"use": "380bb7a3-cdcc-4336-a699-5070cbf521a5",
"as": "default"
"use": "95c02df3-fe0a-405b-b506-b7a5b8605b66",
"as": "Insert"
},
"use_selection2": {
"use": "e543c123-b1d9-4a0b-83b2-a9d371da5ff3",
"as": "default"
"use": "69c29be3-ab25-4f56-944e-7ada6307b10c",
"as": "Update"
},
"use_selection3": {
"use": "9c513baf-b279-43fd-ae29-a585c8cbc4f0",

View File

@ -243,6 +243,12 @@ class Data
'jcb_ce_onBeforeModelCustomViewData', [&$item, &$id, &$table]
);
// Make sure the icon is only an icon path
if (strpos($item->icon, '#') !== false)
{
$item->icon = strstr($item->icon, '#', true);
}
// set GUI mapper
$guiMapper = [
'table' => $table,

View File

@ -201,6 +201,12 @@
'jcb_ce_onBeforeModelCustomViewData', [&$item, &$id, &$table]
);
// Make sure the icon is only an icon path
if (strpos($item->icon, '#') !== false)
{
$item->icon = strstr($item->icon, '#', true);
}
// set GUI mapper
$guiMapper = [
'table' => $table,

View File

@ -174,16 +174,18 @@ class Router
// We can only work with ID if the [main get] is a [getItem] dynamicGet for this site view.
$key = ($view['settings']->main_get->gettype == 1) ? 'id' : null;
$view_selected = $selection['view'] ?? null;
$name_selected = $selection['name'] ?? null;
// Construct the enriched view object.
return (object) [
'view' => $view['settings']->code,
'View' => $view['settings']->Code,
'stable' => ($selection['view'] === $view['settings']->code), // sanity check
'target_view' => $selection['view'],
'table' => $selection['table'],
'table_name' => $selection['name'],
'alias' => $this->getSiteViewAliasKey($selection['name'] ?? null, $adminViews),
'stable' => ($view_selected === $view['settings']->code), // sanity check
'target_view' => $view_selected,
'table' => $selection['table'] ?? null,
'table_name' => $name_selected,
'alias' => $this->getSiteViewAliasKey($name_selected, $adminViews),
'key' => $key,
'form' => false
];

View File

@ -145,16 +145,18 @@
// We can only work with ID if the [main get] is a [getItem] dynamicGet for this site view.
$key = ($view['settings']->main_get->gettype == 1) ? 'id' : null;
$view_selected = $selection['view'] ?? null;
$name_selected = $selection['name'] ?? null;
// Construct the enriched view object.
return (object) [
'view' => $view['settings']->code,
'View' => $view['settings']->Code,
'stable' => ($selection['view'] === $view['settings']->code), // sanity check
'target_view' => $selection['view'],
'table' => $selection['table'],
'table_name' => $selection['name'],
'alias' => $this->getSiteViewAliasKey($selection['name'] ?? null, $adminViews),
'stable' => ($view_selected === $view['settings']->code), // sanity check
'target_view' => $view_selected,
'table' => $selection['table'] ?? null,
'table_name' => $name_selected,
'alias' => $this->getSiteViewAliasKey($name_selected, $adminViews),
'key' => $key,
'form' => false
];

View File

@ -121,7 +121,8 @@ class Utilities implements ServiceProviderInterface
public function getFileInjector(Container $container): FileInjector
{
return new FileInjector(
$container->get('Power.Injector')
$container->get('Power.Injector'),
$container->get('Joomla.Power.Injector')
);
}

View File

@ -84,7 +84,8 @@
public function getFileInjector(Container $container): FileInjector
{
return new FileInjector(
$container->get('Power.Injector')
$container->get('Power.Injector'),
$container->get('Joomla.Power.Injector')
);
}

View File

@ -0,0 +1,58 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface SuperInterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
```uml
@startuml
interface SuperInterface #Lavender {
+ init() : bool
+ reset(array $powers) : bool
+ load(string $guid, array $order = ['remote', 'local'], ...) : bool
}
note right of SuperInterface::init
Init all power not found in database
since: 3.2.0
return: bool
end note
note right of SuperInterface::reset
Reset the powers
since: 3.2.0
return: bool
end note
note right of SuperInterface::load
Load a superpower
since: 3.2.0
return: bool
arguments:
string $guid
array $order = ['remote', 'local']
?string $action = null
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,52 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Interfaces;
/**
* Superpower of JCB
*
* @since 3.2.0
*/
interface SuperInterface
{
/**
* Init all power not found in database
*
* @return bool
* @since 3.2.0
*/
public function init(): bool;
/**
* Reset the powers
*
* @param array $powers The global unique ids of the powers
*
* @return bool
* @since 3.2.0
*/
public function reset(array $powers): bool;
/**
* Load a superpower
*
* @param string $guid The global unique id of the power
* @param array $order The search order
* @param string|null $action The action to load power
*
* @return bool
* @since 3.2.0
*/
public function load(string $guid, array $order = ['remote', 'local'], ?string $action = null): bool;
}

View File

@ -0,0 +1,29 @@
/**
* Init all power not found in database
*
* @return bool
* @since 3.2.0
*/
public function init(): bool;
/**
* Reset the powers
*
* @param array $powers The global unique ids of the powers
*
* @return bool
* @since 3.2.0
*/
public function reset(array $powers): bool;
/**
* Load a superpower
*
* @param string $guid The global unique id of the power
* @param array $order The search order
* @param string|null $action The action to load power
*
* @return bool
* @since 3.2.0
*/
public function load(string $guid, array $order = ['remote', 'local'], ?string $action = null): bool;

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "51de80f2-2868-4c2c-8198-ef79349e9bd7",
"implements": null,
"load_selection": null,
"name": "SuperInterface",
"power_version": "1.0.0",
"system_name": "JCB.Interfaces.Super",
"type": "interface",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.Interfaces.SuperInterface",
"description": "Superpower of JCB\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -61,6 +61,7 @@ class Builders << (F,LightGreen) >> #RoyalBlue {
# CMSApplication $app
+ __construct(Config $config, Power $power, ...)
+ set(string $langLabel, string $langView, ...) : void
- normalizeDatabaseValues(string $nameSingleCode, string $name, ...) : ?array
}
note right of Builders::__construct
@ -138,6 +139,21 @@ note right of Builders::set
?array $custom = null
?array $options = null
end note
note right of Builders::normalizeDatabaseValues
Normalizes database values by adjusting the 'length' and 'default' fields based on specific conditions.
This function modifies the database values by replacing placeholder texts and appending specifications
to types based on the 'length' field. It removes unnecessary fields from the result array.
since: 3.2.1
return: ?array
arguments:
string $nameSingleCode
string $name
string $uniquekey
string $iskey
end note
@enduml
```

View File

@ -693,6 +693,8 @@ final class Builders
$field['settings']->null_switch);
// set index types
$_guid = true;
$databaseuniquekey = false;
$databasekey = false;
if ($field['settings']->indexes == 1
&& !in_array(
$field['settings']->datatype, $textKeys
@ -700,6 +702,7 @@ final class Builders
{
// build unique keys of this view for db
$this->databaseuniquekeys->add($nameSingleCode, $name, true);
$databaseuniquekey = true;
// prevent guid from being added twice
if ('guid' === $name)
{
@ -715,6 +718,7 @@ final class Builders
{
// build keys of this view for db
$this->databasekeys->add($nameSingleCode, $name, true);
$databasekey = true;
}
// special treatment for GUID
if ('guid' === $name && $_guid)
@ -1300,10 +1304,61 @@ final class Builders
'title' => (is_string($title_) && $name === $title_) ? true : false,
'list' => $nameListCode,
'store' => (isset($field['store'])) ? $field['store'] : null,
'tab_name' => $tabName
'tab_name' => $tabName,
'db' => $this->normalizeDatabaseValues($nameSingleCode, $name, $databaseuniquekey, $databasekey)
]
);
}
}
/**
* Normalizes database values by adjusting the 'length' and 'default' fields based on specific conditions.
* This function modifies the database values by replacing placeholder texts and appending specifications
* to types based on the 'length' field. It removes unnecessary fields from the result array.
*
* @param string $nameSingleCode The code for naming single entries.
* @param string $name The name of the database entry.
* @param string $uniquekey Is this field a uniquekey
* @param string $iskey Is this field a key
*
* @return array|null Returns the modified database values array or null if no values are found.
* @since 3.2.1
*/
private function normalizeDatabaseValues($nameSingleCode, $name, $uniquekey, $iskey): ?array
{
$db_values = $this->databasetables->get($nameSingleCode . '.' . $name, null);
if ($db_values === null)
{
return null;
}
if (isset($db_values['lenght']))
{
if ($db_values['lenght'] === 'Other' && isset($db_values['lenght_other']))
{
$db_values['lenght'] = $db_values['lenght_other'];
}
$db_values['lenght'] = trim($db_values['lenght']);
if (strlen($db_values['lenght']))
{
$db_values['type'] .= '(' . $db_values['lenght'] . ')';
}
}
if (isset($db_values['default']))
{
if ($db_values['default'] === 'Other' && isset($db_values['other']))
{
$db_values['default'] = $db_values['other'];
}
}
$db_values['unique_key'] = $uniquekey;
$db_values['key'] = $iskey;
unset($db_values['ID'], $db_values['lenght'], $db_values['lenght_other'], $db_values['other']);
return $db_values;
}
}

View File

@ -616,6 +616,8 @@
$field['settings']->null_switch);
// set index types
$_guid = true;
$databaseuniquekey = false;
$databasekey = false;
if ($field['settings']->indexes == 1
&& !in_array(
$field['settings']->datatype, $textKeys
@ -623,6 +625,7 @@
{
// build unique keys of this view for db
$this->databaseuniquekeys->add($nameSingleCode, $name, true);
$databaseuniquekey = true;
// prevent guid from being added twice
if ('guid' === $name)
{
@ -638,6 +641,7 @@
{
// build keys of this view for db
$this->databasekeys->add($nameSingleCode, $name, true);
$databasekey = true;
}
// special treatment for GUID
if ('guid' === $name && $_guid)
@ -1223,8 +1227,59 @@
'title' => (is_string($title_) && $name === $title_) ? true : false,
'list' => $nameListCode,
'store' => (isset($field['store'])) ? $field['store'] : null,
'tab_name' => $tabName
'tab_name' => $tabName,
'db' => $this->normalizeDatabaseValues($nameSingleCode, $name, $databaseuniquekey, $databasekey)
]
);
}
}
/**
* Normalizes database values by adjusting the 'length' and 'default' fields based on specific conditions.
* This function modifies the database values by replacing placeholder texts and appending specifications
* to types based on the 'length' field. It removes unnecessary fields from the result array.
*
* @param string $nameSingleCode The code for naming single entries.
* @param string $name The name of the database entry.
* @param string $uniquekey Is this field a uniquekey
* @param string $iskey Is this field a key
*
* @return array|null Returns the modified database values array or null if no values are found.
* @since 3.2.1
*/
private function normalizeDatabaseValues($nameSingleCode, $name, $uniquekey, $iskey): ?array
{
$db_values = $this->databasetables->get($nameSingleCode . '.' . $name, null);
if ($db_values === null)
{
return null;
}
if (isset($db_values['lenght']))
{
if ($db_values['lenght'] === 'Other' && isset($db_values['lenght_other']))
{
$db_values['lenght'] = $db_values['lenght_other'];
}
$db_values['lenght'] = trim($db_values['lenght']);
if (strlen($db_values['lenght']))
{
$db_values['type'] .= '(' . $db_values['lenght'] . ')';
}
}
if (isset($db_values['default']))
{
if ($db_values['default'] === 'Other' && isset($db_values['other']))
{
$db_values['default'] = $db_values['other'];
}
}
$db_values['unique_key'] = $uniquekey;
$db_values['key'] = $iskey;
unset($db_values['ID'], $db_values['lenght'], $db_values['lenght_other'], $db_values['other']);
return $db_values;
}

View File

@ -0,0 +1,101 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# class JoomlaPower (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Service**
```uml
@startuml
class JoomlaPower #Gold {
+ register(Container $container) : void
+ getPowers(Container $container) : Powers
+ getSuperpower(Container $container) : Superpower
+ getGrep(Container $container) : Grep
+ getExtractor(Container $container) : Extractor
+ getInjector(Container $container) : Injector
+ getModelUpsert(Container $container) : Upsert
+ getInsert(Container $container) : Insert
+ getUpdate(Container $container) : Update
}
note right of JoomlaPower::register
Registers the service provider with a DI container.
since: 3.2.0
return: void
end note
note left of JoomlaPower::getPowers
Get the Powers
since: 3.2.0
return: Powers
end note
note right of JoomlaPower::getSuperpower
Get the Superpower
since: 3.2.0
return: Superpower
end note
note left of JoomlaPower::getGrep
Get the Grep
since: 3.2.0
return: Grep
end note
note right of JoomlaPower::getExtractor
Get the Compiler Power Extractor
since: 3.2.0
return: Extractor
end note
note left of JoomlaPower::getInjector
Get the Compiler Power Injector
since: 3.2.0
return: Injector
end note
note right of JoomlaPower::getModelUpsert
Get the Power Model Upsert
since: 3.2.0
return: Upsert
end note
note left of JoomlaPower::getInsert
Get the Power Insert
since: 3.2.0
return: Insert
end note
note right of JoomlaPower::getUpdate
Get the Power Update
since: 3.2.0
return: Update
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,202 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower as Powers;
use VDM\Joomla\Componentbuilder\JoomlaPower\Grep;
use VDM\Joomla\Componentbuilder\JoomlaPower\Super as Superpower;
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Extractor;
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Injector;
use VDM\Joomla\Componentbuilder\JoomlaPower\Model\Upsert;
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Insert;
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Update;
/**
* Compiler Joomla Power Service Provider
*
* @since 3.2.0
*/
class JoomlaPower implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Powers::class, 'Joomla.Power')
->share('Joomla.Power', [$this, 'getPowers'], true);
$container->alias(Superpower::class, 'Joomlapower')
->share('Joomlapower', [$this, 'getSuperpower'], true);
$container->alias(Grep::class, 'Joomla.Power.Grep')
->share('Joomla.Power.Grep', [$this, 'getGrep'], true);
$container->alias(Extractor::class, 'Joomla.Power.Extractor')
->share('Joomla.Power.Extractor', [$this, 'getExtractor'], true);
$container->alias(Injector::class, 'Joomla.Power.Injector')
->share('Joomla.Power.Injector', [$this, 'getInjector'], true);
$container->alias(Upsert::class, 'Joomla.Power.Model.Upsert')
->share('Joomla.Power.Model.Upsert', [$this, 'getModelUpsert'], true);
$container->alias(Insert::class, 'Joomla.Power.Insert')
->share('Joomla.Power.Insert', [$this, 'getInsert'], true);
$container->alias(Update::class, 'Joomla.Power.Update')
->share('Joomla.Power.Update', [$this, 'getUpdate'], true);
}
/**
* Get the Powers
*
* @param Container $container The DI container.
*
* @return Powers
* @since 3.2.0
*/
public function getPowers(Container $container): Powers
{
return new Powers(
$container->get('Config'),
$container->get('Placeholder'),
$container->get('Customcode'),
$container->get('Customcode.Gui'),
$container->get('Joomlapower')
);
}
/**
* Get the Superpower
*
* @param Container $container The DI container.
*
* @return Superpower
* @since 3.2.0
*/
public function getSuperpower(Container $container): Superpower
{
return new Superpower(
$container->get('Joomla.Power.Grep'),
$container->get('Joomla.Power.Insert'),
$container->get('Joomla.Power.Update')
);
}
/**
* Get the Grep
*
* @param Container $container The DI container.
*
* @return Grep
* @since 3.2.0
*/
public function getGrep(Container $container): Grep
{
return new Grep(
$container->get('Config')->local_joomla_powers_repository_path,
$container->get('Config')->approved_joomla_paths,
$container->get('Gitea.Repository.Contents')
);
}
/**
* Get the Compiler Power Extractor
*
* @param Container $container The DI container.
*
* @return Extractor
* @since 3.2.0
*/
public function getExtractor(Container $container): Extractor
{
return new Extractor(
$container->get('Config')->joomla_version
);
}
/**
* Get the Compiler Power Injector
*
* @param Container $container The DI container.
*
* @return Injector
* @since 3.2.0
*/
public function getInjector(Container $container): Injector
{
return new Injector(
$container->get('Joomla.Power'),
$container->get('Joomla.Power.Extractor'),
$container->get('Power.Parser'),
$container->get('Placeholder')
);
}
/**
* Get the Power Model Upsert
*
* @param Container $container The DI container.
*
* @return Upsert
* @since 3.2.0
*/
public function getModelUpsert(Container $container): Upsert
{
return new Upsert(
$container->get('Table')
);
}
/**
* Get the Power Insert
*
* @param Container $container The DI container.
*
* @return Insert
* @since 3.2.0
*/
public function getInsert(Container $container): Insert
{
return new Insert(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Insert')
);
}
/**
* Get the Power Update
*
* @param Container $container The DI container.
*
* @return Update
* @since 3.2.0
*/
public function getUpdate(Container $container): Update
{
return new Update(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Update')
);
}
}

View File

@ -0,0 +1,167 @@
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Powers::class, 'Joomla.Power')
->share('Joomla.Power', [$this, 'getPowers'], true);
$container->alias(Superpower::class, 'Joomlapower')
->share('Joomlapower', [$this, 'getSuperpower'], true);
$container->alias(Grep::class, 'Joomla.Power.Grep')
->share('Joomla.Power.Grep', [$this, 'getGrep'], true);
$container->alias(Extractor::class, 'Joomla.Power.Extractor')
->share('Joomla.Power.Extractor', [$this, 'getExtractor'], true);
$container->alias(Injector::class, 'Joomla.Power.Injector')
->share('Joomla.Power.Injector', [$this, 'getInjector'], true);
$container->alias(Upsert::class, 'Joomla.Power.Model.Upsert')
->share('Joomla.Power.Model.Upsert', [$this, 'getModelUpsert'], true);
$container->alias(Insert::class, 'Joomla.Power.Insert')
->share('Joomla.Power.Insert', [$this, 'getInsert'], true);
$container->alias(Update::class, 'Joomla.Power.Update')
->share('Joomla.Power.Update', [$this, 'getUpdate'], true);
}
/**
* Get the Powers
*
* @param Container $container The DI container.
*
* @return Powers
* @since 3.2.0
*/
public function getPowers(Container $container): Powers
{
return new Powers(
$container->get('Config'),
$container->get('Placeholder'),
$container->get('Customcode'),
$container->get('Customcode.Gui'),
$container->get('Joomlapower')
);
}
/**
* Get the Superpower
*
* @param Container $container The DI container.
*
* @return Superpower
* @since 3.2.0
*/
public function getSuperpower(Container $container): Superpower
{
return new Superpower(
$container->get('Joomla.Power.Grep'),
$container->get('Joomla.Power.Insert'),
$container->get('Joomla.Power.Update')
);
}
/**
* Get the Grep
*
* @param Container $container The DI container.
*
* @return Grep
* @since 3.2.0
*/
public function getGrep(Container $container): Grep
{
return new Grep(
$container->get('Config')->local_joomla_powers_repository_path,
$container->get('Config')->approved_joomla_paths,
$container->get('Gitea.Repository.Contents')
);
}
/**
* Get the Compiler Power Extractor
*
* @param Container $container The DI container.
*
* @return Extractor
* @since 3.2.0
*/
public function getExtractor(Container $container): Extractor
{
return new Extractor(
$container->get('Config')->joomla_version
);
}
/**
* Get the Compiler Power Injector
*
* @param Container $container The DI container.
*
* @return Injector
* @since 3.2.0
*/
public function getInjector(Container $container): Injector
{
return new Injector(
$container->get('Joomla.Power'),
$container->get('Joomla.Power.Extractor'),
$container->get('Power.Parser'),
$container->get('Placeholder')
);
}
/**
* Get the Power Model Upsert
*
* @param Container $container The DI container.
*
* @return Upsert
* @since 3.2.0
*/
public function getModelUpsert(Container $container): Upsert
{
return new Upsert(
$container->get('Table')
);
}
/**
* Get the Power Insert
*
* @param Container $container The DI container.
*
* @return Insert
* @since 3.2.0
*/
public function getInsert(Container $container): Insert
{
return new Insert(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Insert')
);
}
/**
* Get the Power Update
*
* @param Container $container The DI container.
*
* @return Update
* @since 3.2.0
*/
public function getUpdate(Container $container): Update
{
return new Update(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Update')
);
}

View File

@ -0,0 +1,54 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "0",
"guid": "5716c79f-a1c9-4059-9d00-8cccb9f9e061",
"implements": [
"-1"
],
"load_selection": null,
"name": "JoomlaPower",
"power_version": "1.0.0",
"system_name": "JCB.Compiler.Service.JoomlaPower",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "3730a000-ab64-477d-8b0f-70eaf71b517a",
"as": "Powers"
},
"use_selection1": {
"use": "355bf21a-f859-4528-9110-bcd2c6d05ea7",
"as": "default"
},
"use_selection2": {
"use": "39a75870-a7f7-45fd-937d-5ba97b85b8ad",
"as": "Superpower"
},
"use_selection3": {
"use": "82505f3f-297f-4d75-a581-929ab3e93689",
"as": "default"
},
"use_selection4": {
"use": "a6052fe9-0d2b-4b36-b3e7-03b47c483542",
"as": "default"
},
"use_selection5": {
"use": "9206082e-a3f7-472e-98b2-de90d06cbdcd",
"as": "default"
},
"use_selection6": {
"use": "9d53d45e-9b4d-45ec-827b-4916b91c907e",
"as": "default"
},
"use_selection7": {
"use": "679473f6-3ea2-49d5-8273-1b29c8f0ad2b",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Service.JoomlaPower",
"description": "Compiler Joomla Power Service Provider\r\n\r\n@since 3.2.0",
"implements_custom": "ServiceProviderInterface",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
"composer": ""
}

View File

@ -6,11 +6,11 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Grep (Details)
# class Grep (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power**
```uml
@startuml
class Grep << (F,LightGreen) >> #RoyalBlue {
class Grep #Gold {
+ ?string $path
+ ?array $paths
# Contents $contents

View File

@ -19,6 +19,7 @@ use Joomla\CMS\Language\Text;
use VDM\Joomla\Gitea\Repository\Contents;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Componentbuilder\Interfaces\GrepInterface;
/**
@ -31,7 +32,7 @@ use VDM\Joomla\Utilities\JsonHelper;
*
* @since 3.2.0
*/
final class Grep
class Grep implements GrepInterface
{
/**
* The local path

View File

@ -3,12 +3,14 @@
"add_licensing_template": "2",
"extends": "0",
"guid": "6784dd52-0909-451a-a872-9a942a023c68",
"implements": null,
"implements": [
"c182506a-ab84-439c-b962-1e606b58d545"
],
"load_selection": null,
"name": "Grep",
"power_version": "1.0.0",
"system_name": "JCB.Power.Grep",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "8d1baef6-fcad-49a9-848f-428009cdb989",

View File

@ -0,0 +1,31 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Update (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Database**
> extends: **ExtendingUpdate**
```uml
@startuml
class Update << (F,LightGreen) >> #RoyalBlue {
# string $table
}
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Database;
use VDM\Joomla\Componentbuilder\Interfaces\Database\UpdateInterface;
use VDM\Joomla\Componentbuilder\Power\Database\Update as ExtendingUpdate;
/**
* Joomla Power Database Update
*
* @since 3.2.0
*/
final class Update extends ExtendingUpdate implements UpdateInterface
{
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'joomla_power';
}

View File

@ -0,0 +1,7 @@
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'joomla_power';

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "e543c123-b1d9-4a0b-83b2-a9d371da5ff3",
"guid": "679473f6-3ea2-49d5-8273-1b29c8f0ad2b",
"implements": [
"69c29be3-ab25-4f56-944e-7ada6307b10c"
],
"load_selection": null,
"name": "Update",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Database.Update",
"type": "final class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Database.Update",
"description": "Joomla Power Database Update\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,80 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface UpdateInterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Interfaces\Database**
```uml
@startuml
interface UpdateInterface #Lavender {
+ value(mixed $value, string $field, ...) : bool
+ row(array $item) : bool
+ rows(?array $items) : bool
+ item(object $item) : bool
+ items(?array $items) : bool
}
note right of UpdateInterface::value
Update a value to a given table
Example: $this->value(Value, 'value_key', 'GUID');
since: 3.2.0
return: bool
arguments:
mixed $value
string $field
string $keyValue
string $key = 'guid'
end note
note right of UpdateInterface::row
Update single row with multiple values to a given table
Example: $this->item(Array);
since: 3.2.0
return: bool
end note
note right of UpdateInterface::rows
Update multiple rows to a given table
Example: $this->items(Array);
since: 3.2.0
return: bool
end note
note right of UpdateInterface::item
Update single item with multiple values to a given table
Example: $this->item(Object);
since: 3.2.0
return: bool
end note
note right of UpdateInterface::items
Update multiple items to a given table
Example: $this->items(Array);
since: 3.2.0
return: bool
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,80 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Interfaces\Database;
/**
* Database Update
*
* @since 3.2.1
*/
interface UpdateInterface
{
/**
* Update a value to a given table
* Example: $this->value(Value, 'value_key', 'GUID');
*
* @param mixed $value The field value
* @param string $field The field key
* @param string $keyValue The key value
* @param string $key The key name
*
* @return bool
* @since 3.2.0
*/
public function value($value, string $field, string $keyValue, string $key = 'guid'): bool;
/**
* Update single row with multiple values to a given table
* Example: $this->item(Array);
*
* @param array $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function row(array $item): bool;
/**
* Update multiple rows to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of arrays)
*
* @return bool
* @since 3.2.0
*/
public function rows(?array $items): bool;
/**
* Update single item with multiple values to a given table
* Example: $this->item(Object);
*
* @param object $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function item(object $item): bool;
/**
* Update multiple items to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of objects)
*
* @return bool
* @since 3.2.0
*/
public function items(?array $items): bool;
}

View File

@ -0,0 +1,57 @@
/**
* Update a value to a given table
* Example: $this->value(Value, 'value_key', 'GUID');
*
* @param mixed $value The field value
* @param string $field The field key
* @param string $keyValue The key value
* @param string $key The key name
*
* @return bool
* @since 3.2.0
*/
public function value($value, string $field, string $keyValue, string $key = 'guid'): bool;
/**
* Update single row with multiple values to a given table
* Example: $this->item(Array);
*
* @param array $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function row(array $item): bool;
/**
* Update multiple rows to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of arrays)
*
* @return bool
* @since 3.2.0
*/
public function rows(?array $items): bool;
/**
* Update single item with multiple values to a given table
* Example: $this->item(Object);
*
* @param object $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function item(object $item): bool;
/**
* Update multiple items to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of objects)
*
* @return bool
* @since 3.2.0
*/
public function items(?array $items): bool;

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "69c29be3-ab25-4f56-944e-7ada6307b10c",
"implements": null,
"load_selection": null,
"name": "UpdateInterface",
"power_version": "1.0.0",
"system_name": "JCB.Interfaces.Database.UpdateInterface",
"type": "interface",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.Interfaces.Database.UpdateInterface",
"description": "Database Update\r\n\r\n@since 3.2.1",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -546,10 +546,14 @@ final class CustomFieldTypeFile
if ($this->config->get('joomla_version', 3) != 3)
{
$placeholders['JFactory::getUser()'] = 'Factory::getApplication()->getIdentity()';
$placeholders['\JFactory::getUser()'] = 'Factory::getApplication()->getIdentity()';
$placeholders['Factory::getUser()'] = 'Factory::getApplication()->getIdentity()';
$placeholders['JFactory::'] = 'Factory::';
$placeholders['\JFactory::'] = 'Factory::';
$placeholders['JHtml::'] = 'Html::';
$placeholders['\JHtml::'] = 'Html::';
$placeholders['JText::'] = 'Text::';
$placeholders['\JText::'] = 'Text::';
$placeholders['JComponentHelper::'] = 'ComponentHelper::';
$placeholders['\JComponentHelper::'] = 'ComponentHelper::';
}

View File

@ -500,10 +500,14 @@
if ($this->config->get('joomla_version', 3) != 3)
{
$placeholders['JFactory::getUser()'] = 'Factory::getApplication()->getIdentity()';
$placeholders['\JFactory::getUser()'] = 'Factory::getApplication()->getIdentity()';
$placeholders['Factory::getUser()'] = 'Factory::getApplication()->getIdentity()';
$placeholders['JFactory::'] = 'Factory::';
$placeholders['\JFactory::'] = 'Factory::';
$placeholders['JHtml::'] = 'Html::';
$placeholders['\JHtml::'] = 'Html::';
$placeholders['JText::'] = 'Text::';
$placeholders['\JText::'] = 'Text::';
$placeholders['JComponentHelper::'] = 'ComponentHelper::';
$placeholders['\JComponentHelper::'] = 'ComponentHelper::';
}

View File

@ -16,13 +16,10 @@ class Autoloader #Gold {
# Content $content
# string $helper
+ __construct(Power $power, Config $config, ...)
+ setFiles() : void
+ set() : void
- loadPluginAutoloader() : bool
- loadHelperAutoloader() : bool
- loadSiteAutoloader() : bool
- getPluginAutoloader() : string
- getHelperAutoloader() : string
- getBLockSiteLoading() : ?string
- getAutoloaderFile(int $tabSpace, string $area = 'JPATH_ADMINISTRATOR') : ?string
- getAutoloader(int $tabSpace) : ?string
- getComposer(int $tabSpace) : ?string
}
@ -38,39 +35,18 @@ note right of Autoloader::__construct
Content $content
end note
note left of Autoloader::set
note right of Autoloader::setFiles
Set the autoloader into the active content array
since: 3.2.0
return: void
end note
note right of Autoloader::loadPluginAutoloader
Should we load the plugin autoloader
note right of Autoloader::set
Set the autoloader into the active content array
since: 3.2.0
return: bool
end note
note left of Autoloader::loadHelperAutoloader
Should we load the helper class autoloader
since: 3.2.0
return: bool
end note
note right of Autoloader::loadSiteAutoloader
Should we load the autoloader in site area
since: 3.2.0
return: bool
end note
note left of Autoloader::getPluginAutoloader
Get helper autoloader code
since: 3.2.0
return: string
return: void
end note
note right of Autoloader::getHelperAutoloader
@ -80,11 +56,10 @@ note right of Autoloader::getHelperAutoloader
return: string
end note
note left of Autoloader::getBLockSiteLoading
Get code that will block the plugin from loading
the autoloader in the site area
note right of Autoloader::getAutoloaderFile
Get autoloader file
since: 3.2.0
since: 3.2.1
return: ?string
end note
@ -95,7 +70,7 @@ note right of Autoloader::getAutoloader
return: ?string
end note
note left of Autoloader::getComposer
note right of Autoloader::getComposer
Get the composer autoloader routine
since: 3.2.0

View File

@ -77,7 +77,27 @@ class Autoloader
// reset all autoloaders power placeholders
$this->content->set('ADMIN_POWER_HELPER', '');
$this->content->set('SITE_POWER_HELPER', '');
$this->content->set('PLUGIN_POWER_AUTOLOADER', '');
$this->content->set('CUSTOM_POWER_AUTOLOADER', '');
$this->content->set('SITE_PLUGIN_POWER_AUTOLOADER', '');
$this->content->set('SITE_CUSTOM_POWER_AUTOLOADER', '');
}
/**
* Set the autoloader into the active content array
*
* @return void
* @since 3.2.0
*/
public function setFiles()
{
// check if we are using a plugin
$this->content->set('PLUGIN_POWER_AUTOLOADER', PHP_EOL . PHP_EOL . $this->getAutoloaderFile(2));
$this->content->set('SITE_PLUGIN_POWER_AUTOLOADER', PHP_EOL . PHP_EOL . $this->getAutoloaderFile(2, 'JPATH_SITE'));
// to add to custom files
$this->content->add('CUSTOM_POWER_AUTOLOADER', $this->getAutoloaderFile(0));
$this->content->add('SITE_CUSTOM_POWER_AUTOLOADER', $this->getAutoloaderFile(0, 'JPATH_SITE'));
}
/**
@ -88,9 +108,10 @@ class Autoloader
*/
public function set()
{
if (ArrayHelper::check($this->power->namespace))
// make sure we only load this once
if (ArrayHelper::check($this->power->namespace) && !$this->content->isString('ADMIN_POWER_HELPER'))
{
/************************* IMPORTANT SORT NOTICE ***********************************************
/* ********************** IMPORTANT SORT NOTICE *****************************************
* make sure the name space values are sorted from the longest string to the shortest
* so that the search do not mistakenly match a shorter namespace before a longer one
* that has the same short namespace for example:
@ -101,110 +122,18 @@ class Autoloader
* ^^^^^^^^^^^^^^^^^^^^^^
* NameSpace\SubName\SubSubName\ClassName
* ^^^^^^^^^^^^^^^^^^^^^^
***********************************************************************************************/
** *********************************************************************************************/
uksort($this->power->namespace, fn($a, $b) => strlen((string) $b) - strlen((string) $a));
// check if we are using a plugin
if ($this->loadPluginAutoloader())
{
$this->content->set('PLUGIN_POWER_AUTOLOADER', $this->getPluginAutoloader());
}
// load to admin helper class
$this->content->add('ADMIN_POWER_HELPER', $this->getHelperAutoloader());
// load to the helper class
if ($this->loadHelperAutoloader())
{
// load to admin helper class
$this->content->add('ADMIN_POWER_HELPER', $this->getHelperAutoloader());
// load to site helper class if needed
if ($this->loadSiteAutoloader())
{
$this->content->add('SITE_POWER_HELPER', $this->getHelperAutoloader());
}
}
// to add to custom files
$this->content->add('CUSTOM_POWER_AUTOLOADER', $this->getHelperAutoloader());
// load to site helper class if needed
$this->content->add('SITE_POWER_HELPER', $this->getHelperAutoloader());
}
}
/**
* Should we load the plugin autoloader
*
* @return bool
* @since 3.2.0
*/
private function loadPluginAutoloader(): bool
{
return $this->content->exists('PLUGIN_POWER_AUTOLOADER');
}
/**
* Should we load the helper class autoloader
*
* @return bool
* @since 3.2.0
*/
private function loadHelperAutoloader(): bool
{
// for now we load it if the plugin is not loaded
// but we may want to add a switch that
// controls this behaviour.
// return !$this->loadPluginAutoloader();
// lets load it anyway (can't break anything)
// but we will still like a switch for this
return true;
}
/**
* Should we load the autoloader in site area
*
* @return bool
* @since 3.2.0
*/
private function loadSiteAutoloader(): bool
{
return (!$this->config->remove_site_folder || !$this->config->remove_site_edit_folder);
}
/**
* Get helper autoloader code
*
* @return string
* @since 3.2.0
*/
private function getPluginAutoloader(): string
{
// load the code
$code = [];
// if we should not load in the site are
if (($script = $this->getBLockSiteLoading()) !== null)
{
$code[] = $script;
}
// add the composer stuff here
if (($script = $this->getComposer(2)) !== null)
{
$code[] = $script;
}
// get the helper autoloader
if (($script = $this->getAutoloader(2)) !== null)
{
$code[] = $script;
}
// if we have any
if (!empty($code))
{
return PHP_EOL . PHP_EOL . implode(PHP_EOL . PHP_EOL, $code);
}
return '';
}
/**
* Get helper autoloader code
*
@ -244,30 +173,29 @@ class Autoloader
}
/**
* Get code that will block the plugin from loading
* the autoloader in the site area
* Get autoloader file
*
* @param int $tabSpace The dynamic tab spacer
* @param string $area The target area
*
* @return string|null
* @since 3.2.0
* @since 3.2.1
*/
private function getBLockSiteLoading(): ?string
private function getAutoloaderFile(int $tabSpace, string $area = 'JPATH_ADMINISTRATOR'): ?string
{
// if we should not load in the site are
if (!$this->loadSiteAutoloader())
{
// we add code to prevent this plugin from triggering on the site area
$not_site = [];
$not_site[] = Indent::_(2) . '//'
. Line::_(__Line__, __Class__) . ' do not run the autoloader in the site area';
$not_site[] = Indent::_(2) . 'if ($this->app->isClient(\'site\'))';
$not_site[] = Indent::_(2) . '{';
$not_site[] = Indent::_(3) . 'return;';
$not_site[] = Indent::_(2) . '}';
// we start building the autoloaded file loader
$autoload_file = [];
$autoload_file[] = Indent::_($tabSpace) . '//'
. Line::_(__Line__, __Class__) . " The power autoloader for this project ($area) area.";
$autoload_file[] = Indent::_($tabSpace) . "\$power_autoloader = $area . '/components/com_"
. $this->config->get('component_code_name', 'ERROR') . '/'
. $this->config->get('component_autoloader_path', 'ERROR') . "';";
$autoload_file[] = Indent::_($tabSpace) . 'if (file_exists($power_autoloader))';
$autoload_file[] = Indent::_($tabSpace) . '{';
$autoload_file[] = Indent::_($tabSpace) . Indent::_(1) . 'require_once $power_autoloader;';
$autoload_file[] = Indent::_($tabSpace) . '}';
return implode(PHP_EOL, $not_site);
}
return null;
return implode(PHP_EOL, $autoload_file);
}
/**
@ -286,7 +214,7 @@ class Autoloader
$autoload_method = [];
$autoload_method[] = Indent::_($tabSpace) . '//'
. Line::_(__Line__, __Class__) . ' register additional namespace';
$autoload_method[] = Indent::_($tabSpace) . '\spl_autoload_register(function ($class) {';
$autoload_method[] = Indent::_($tabSpace) . 'spl_autoload_register(function ($class) {';
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '//'
. Line::_(__Line__, __Class__) . ' project-specific base directories and namespace prefix';
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '$search = [';

View File

@ -48,7 +48,27 @@
// reset all autoloaders power placeholders
$this->content->set('ADMIN_POWER_HELPER', '');
$this->content->set('SITE_POWER_HELPER', '');
$this->content->set('PLUGIN_POWER_AUTOLOADER', '');
$this->content->set('CUSTOM_POWER_AUTOLOADER', '');
$this->content->set('SITE_PLUGIN_POWER_AUTOLOADER', '');
$this->content->set('SITE_CUSTOM_POWER_AUTOLOADER', '');
}
/**
* Set the autoloader into the active content array
*
* @return void
* @since 3.2.0
*/
public function setFiles()
{
// check if we are using a plugin
$this->content->set('PLUGIN_POWER_AUTOLOADER', PHP_EOL . PHP_EOL . $this->getAutoloaderFile(2));
$this->content->set('SITE_PLUGIN_POWER_AUTOLOADER', PHP_EOL . PHP_EOL . $this->getAutoloaderFile(2, 'JPATH_SITE'));
// to add to custom files
$this->content->add('CUSTOM_POWER_AUTOLOADER', $this->getAutoloaderFile(0));
$this->content->add('SITE_CUSTOM_POWER_AUTOLOADER', $this->getAutoloaderFile(0, 'JPATH_SITE'));
}
/**
@ -59,9 +79,10 @@
*/
public function set()
{
if (ArrayHelper::check($this->power->namespace))
// make sure we only load this once
if (ArrayHelper::check($this->power->namespace) && !$this->content->isString('ADMIN_POWER_HELPER'))
{
/************************* IMPORTANT SORT NOTICE ***********************************************
/* ********************** IMPORTANT SORT NOTICE *****************************************
* make sure the name space values are sorted from the longest string to the shortest
* so that the search do not mistakenly match a shorter namespace before a longer one
* that has the same short namespace for example:
@ -72,110 +93,18 @@
* ^^^^^^^^^^^^^^^^^^^^^^
* NameSpace\SubName\SubSubName\ClassName
* ^^^^^^^^^^^^^^^^^^^^^^
***********************************************************************************************/
** *********************************************************************************************/
uksort($this->power->namespace, fn($a, $b) => strlen((string) $b) - strlen((string) $a));
// check if we are using a plugin
if ($this->loadPluginAutoloader())
{
$this->content->set('PLUGIN_POWER_AUTOLOADER', $this->getPluginAutoloader());
}
// load to admin helper class
$this->content->add('ADMIN_POWER_HELPER', $this->getHelperAutoloader());
// load to the helper class
if ($this->loadHelperAutoloader())
{
// load to admin helper class
$this->content->add('ADMIN_POWER_HELPER', $this->getHelperAutoloader());
// load to site helper class if needed
if ($this->loadSiteAutoloader())
{
$this->content->add('SITE_POWER_HELPER', $this->getHelperAutoloader());
}
}
// to add to custom files
$this->content->add('CUSTOM_POWER_AUTOLOADER', $this->getHelperAutoloader());
// load to site helper class if needed
$this->content->add('SITE_POWER_HELPER', $this->getHelperAutoloader());
}
}
/**
* Should we load the plugin autoloader
*
* @return bool
* @since 3.2.0
*/
private function loadPluginAutoloader(): bool
{
return $this->content->exists('PLUGIN_POWER_AUTOLOADER');
}
/**
* Should we load the helper class autoloader
*
* @return bool
* @since 3.2.0
*/
private function loadHelperAutoloader(): bool
{
// for now we load it if the plugin is not loaded
// but we may want to add a switch that
// controls this behaviour.
// return !$this->loadPluginAutoloader();
// lets load it anyway (can't break anything)
// but we will still like a switch for this
return true;
}
/**
* Should we load the autoloader in site area
*
* @return bool
* @since 3.2.0
*/
private function loadSiteAutoloader(): bool
{
return (!$this->config->remove_site_folder || !$this->config->remove_site_edit_folder);
}
/**
* Get helper autoloader code
*
* @return string
* @since 3.2.0
*/
private function getPluginAutoloader(): string
{
// load the code
$code = [];
// if we should not load in the site are
if (($script = $this->getBLockSiteLoading()) !== null)
{
$code[] = $script;
}
// add the composer stuff here
if (($script = $this->getComposer(2)) !== null)
{
$code[] = $script;
}
// get the helper autoloader
if (($script = $this->getAutoloader(2)) !== null)
{
$code[] = $script;
}
// if we have any
if (!empty($code))
{
return PHP_EOL . PHP_EOL . implode(PHP_EOL . PHP_EOL, $code);
}
return '';
}
/**
* Get helper autoloader code
*
@ -215,30 +144,29 @@
}
/**
* Get code that will block the plugin from loading
* the autoloader in the site area
* Get autoloader file
*
* @param int $tabSpace The dynamic tab spacer
* @param string $area The target area
*
* @return string|null
* @since 3.2.0
* @since 3.2.1
*/
private function getBLockSiteLoading(): ?string
private function getAutoloaderFile(int $tabSpace, string $area = 'JPATH_ADMINISTRATOR'): ?string
{
// if we should not load in the site are
if (!$this->loadSiteAutoloader())
{
// we add code to prevent this plugin from triggering on the site area
$not_site = [];
$not_site[] = Indent::_(2) . '//'
. Line::_(__Line__, __Class__) . ' do not run the autoloader in the site area';
$not_site[] = Indent::_(2) . 'if ($this->app->isClient(\'site\'))';
$not_site[] = Indent::_(2) . '{';
$not_site[] = Indent::_(3) . 'return;';
$not_site[] = Indent::_(2) . '}';
// we start building the autoloaded file loader
$autoload_file = [];
$autoload_file[] = Indent::_($tabSpace) . '//'
. Line::_(__Line__, __Class__) . " The power autoloader for this project ($area) area.";
$autoload_file[] = Indent::_($tabSpace) . "\$power_autoloader = $area . '/components/com_"
. $this->config->get('component_code_name', 'ERROR') . '/'
. $this->config->get('component_autoloader_path', 'ERROR') . "';";
$autoload_file[] = Indent::_($tabSpace) . 'if (file_exists($power_autoloader))';
$autoload_file[] = Indent::_($tabSpace) . '{';
$autoload_file[] = Indent::_($tabSpace) . Indent::_(1) . 'require_once $power_autoloader;';
$autoload_file[] = Indent::_($tabSpace) . '}';
return implode(PHP_EOL, $not_site);
}
return null;
return implode(PHP_EOL, $autoload_file);
}
/**
@ -257,7 +185,7 @@
$autoload_method = [];
$autoload_method[] = Indent::_($tabSpace) . '//'
. Line::_(__Line__, __Class__) . ' register additional namespace';
$autoload_method[] = Indent::_($tabSpace) . '\spl_autoload_register(function ($class) {';
$autoload_method[] = Indent::_($tabSpace) . 'spl_autoload_register(function ($class) {';
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '//'
. Line::_(__Line__, __Class__) . ' project-specific base directories and namespace prefix';
$autoload_method[] = Indent::_($tabSpace) . Indent::_(1) . '$search = [';

View File

@ -0,0 +1,54 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# abstract class Factory (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower**
```uml
@startuml
abstract Factory #Orange {
# static $container
+ {static} _(string $key) : Mixed
+ {static} getContainer() : Container
# {static} createContainer() : Container
}
note right of Factory::_
Get any class from the package container
since: 3.2.0
return: Mixed
end note
note right of Factory::getContainer
Get the global package container
since: 3.2.0
return: Container
end note
note right of Factory::createContainer
Create a container object
since: 3.2.0
return: Container
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,86 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower;
use Joomla\DI\Container;
use VDM\Joomla\Componentbuilder\JoomlaPower\Service\JoomlaPower as Power;
use VDM\Joomla\Componentbuilder\Service\Database;
use VDM\Joomla\Componentbuilder\JoomlaPower\Service\Database as PowerDatabase;
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;
/**
* Joomla Power Factory
*
* @since 3.2.0
*/
abstract class Factory implements FactoryInterface
{
/**
* Global Package Container
*
* @var Container
* @since 3.2.0
**/
protected static $container = null;
/**
* Get any class from the package container
*
* @param string $key The container class key
*
* @return Mixed
* @since 3.2.0
*/
public static function _($key)
{
return self::getContainer()->get($key);
}
/**
* Get the global package container
*
* @return Container
* @since 3.2.0
*/
public static function getContainer(): Container
{
if (!self::$container)
{
self::$container = self::createContainer();
}
return self::$container;
}
/**
* Create a container object
*
* @return Container
* @since 3.2.0
*/
protected static function createContainer(): Container
{
return (new Container())
->registerServiceProvider(new Power())
->registerServiceProvider(new Database())
->registerServiceProvider(new PowerDatabase())
->registerServiceProvider(new Gitea())
->registerServiceProvider(new GiteaPower())
->registerServiceProvider(new GiteaUtilities());
}
}

View File

@ -0,0 +1,53 @@
/**
* Global Package Container
*
* @var Container
* @since 3.2.0
**/
protected static $container = null;
/**
* Get any class from the package container
*
* @param string $key The container class key
*
* @return Mixed
* @since 3.2.0
*/
public static function _($key)
{
return self::getContainer()->get($key);
}
/**
* Get the global package container
*
* @return Container
* @since 3.2.0
*/
public static function getContainer(): Container
{
if (!self::$container)
{
self::$container = self::createContainer();
}
return self::$container;
}
/**
* Create a container object
*
* @return Container
* @since 3.2.0
*/
protected static function createContainer(): Container
{
return (new Container())
->registerServiceProvider(new Power())
->registerServiceProvider(new Database())
->registerServiceProvider(new PowerDatabase())
->registerServiceProvider(new Gitea())
->registerServiceProvider(new GiteaPower())
->registerServiceProvider(new GiteaUtilities());
}

View File

@ -0,0 +1,45 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "0",
"guid": "6ee3dc9e-1949-4da5-a74f-d9eb7f14e400",
"implements": [
"caf33c5d-858c-4f9a-894f-ab302ec5445a"
],
"load_selection": null,
"name": "Factory",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Factory",
"type": "abstract class",
"use_selection": {
"use_selection0": {
"use": "38e1ca3e-1908-459a-be87-9f83b292058f",
"as": "Power"
},
"use_selection1": {
"use": "4815e1c7-a433-443d-a112-d1e03d7df84b",
"as": "default"
},
"use_selection2": {
"use": "a2992a91-eec2-4957-811b-8cde22aa1438",
"as": "PowerDatabase"
},
"use_selection3": {
"use": "71acf8d6-32b8-4173-8277-eb9cda29fd64",
"as": "default"
},
"use_selection4": {
"use": "510dc0f6-da3f-4a78-b43d-3a03e2cb5fae",
"as": "GiteaPower"
},
"use_selection5": {
"use": "6edf0cf3-c2b0-45c9-84d2-c6ef1c5d434c",
"as": "GiteaUtilities"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Factory",
"description": "Joomla Power Factory\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\DI\\Container;",
"composer": ""
}

View File

@ -6,11 +6,11 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Injector (Details)
# class Injector (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Power**
```uml
@startuml
class Injector << (F,LightGreen) >> #RoyalBlue {
class Injector #Gold {
# Power $power
# Extractor $extractor
# Parser $parser
@ -20,7 +20,7 @@ class Injector << (F,LightGreen) >> #RoyalBlue {
# array $traits
# array $other
# array $duplicate
+ __construct(?Power $power = null, ?Extractor $extractor = null, ...)
+ __construct(Power $power = null, Extractor $extractor = null, ...)
+ power(string $code) : string
# update(array $guids, string $code) : string
# inspect(object $power, ?array $useStatements, ...) : ?string
@ -45,10 +45,10 @@ note right of Injector::__construct
since: 3.2.0
arguments:
?Power $power = null
?Extractor $extractor = null
?Parser $parser = null
?Placeholder $placeholder = null
Power $power = null
Extractor $extractor = null
Parser $parser = null
Placeholder $placeholder = null
end note
note left of Injector::power

View File

@ -12,18 +12,18 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Power;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Power;
use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\PowerInterface as Power;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power\ExtractorInterface as Extractor;
use VDM\Joomla\Componentbuilder\Compiler\Power\Parser;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power\InjectorInterface;
/**
* Compiler Power Injector
* @since 3.2.0
*/
final class Injector
class Injector implements InjectorInterface
{
/**
* Power Objects
@ -107,13 +107,13 @@ final class Injector
*
* @since 3.2.0
*/
public function __construct(?Power $power = null, ?Extractor $extractor = null,
?Parser $parser = null, ?Placeholder $placeholder = null)
public function __construct(Power $power = null, Extractor $extractor = null,
Parser $parser = null, Placeholder $placeholder = null)
{
$this->power = $power ?: Compiler::_('Power');
$this->extractor = $extractor ?: Compiler::_('Power.Extractor');
$this->parser = $parser ?: Compiler::_('Power.Parser');
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->power = $power;
$this->extractor = $extractor;
$this->parser = $parser;
$this->placeholder = $placeholder;
}
/**

View File

@ -80,13 +80,13 @@
*
* @since 3.2.0
*/
public function __construct(?Power $power = null, ?Extractor $extractor = null,
?Parser $parser = null, ?Placeholder $placeholder = null)
public function __construct(Power $power = null, Extractor $extractor = null,
Parser $parser = null, Placeholder $placeholder = null)
{
$this->power = $power ?: Compiler::_('Power');
$this->extractor = $extractor ?: Compiler::_('Power.Extractor');
$this->parser = $parser ?: Compiler::_('Power.Parser');
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->power = $power;
$this->extractor = $extractor;
$this->parser = $parser;
$this->placeholder = $placeholder;
}
/**

View File

@ -3,30 +3,28 @@
"add_licensing_template": "2",
"extends": "0",
"guid": "763d137c-42bc-4282-98d8-cc5c0654985f",
"implements": null,
"implements": [
"e923311a-4058-4e81-9f67-5956fd0c627c"
],
"load_selection": null,
"name": "Injector",
"power_version": "1.0.0",
"system_name": "JCB.Compiler.Power.Injector",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
"as": "Compiler"
"use": "1133c2d7-ba7e-4c95-8cde-01f084d04682",
"as": "Power"
},
"use_selection1": {
"use": "b836c1b1-b6b1-44f7-b8a2-9a763a4185b1",
"as": "default"
"use": "c159425c-51f9-4a15-af99-f2d0c6d7aae8",
"as": "Extractor"
},
"use_selection2": {
"use": "eeb03266-22fd-45bb-953a-961bb6be3a54",
"as": "default"
},
"use_selection3": {
"use": "95d0e03f-24fd-4412-bc2e-f0899fcc3205",
"as": "default"
},
"use_selection4": {
"use_selection3": {
"use": "06453ada-e370-49f0-b262-e3f5a8ed0c2c",
"as": "default"
}

View File

@ -6,12 +6,12 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Upsert (Details)
# class Upsert (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power\Model**
> extends: **AbstractionModel**
> extends: **Model**
```uml
@startuml
class Upsert << (F,LightGreen) >> #RoyalBlue {
class Upsert #Gold {
+ value(mixed $value, string $field, ...) : mixed
# validateBefore(mixed $value, ?string $field = null, ...) : bool
# validateAfter(mixed $value, ?string $field = null, ...) : bool

View File

@ -12,11 +12,11 @@
namespace VDM\Joomla\Componentbuilder\Power\Model;
use VDM\Joomla\Abstraction\Model as AbstractionModel;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Interfaces\ModelInterface;
use VDM\Joomla\Abstraction\Model;
/**
@ -24,7 +24,7 @@ use VDM\Joomla\Interfaces\ModelInterface;
*
* @since 3.2.0
*/
final class Upsert extends AbstractionModel implements ModelInterface
class Upsert extends Model implements ModelInterface
{
/**
* Model the value

View File

@ -1,7 +1,7 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "-1",
"extends": "584747d1-3a86-453d-b7a3-a2219de8d777",
"guid": "7c1fb50f-8fb1-4627-8705-6fedf7182ca5",
"implements": [
"8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff"
@ -10,12 +10,8 @@
"name": "Upsert",
"power_version": "1.0.0",
"system_name": "JCB.Power.Model.Upsert",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "584747d1-3a86-453d-b7a3-a2219de8d777",
"as": "AbstractionModel"
},
"use_selection1": {
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
"as": "default"
@ -31,7 +27,6 @@
},
"namespace": "VDM\\Joomla\\Componentbuilder.Power.Model.Upsert",
"description": "Power Model Update or Insert\r\n\r\n@since 3.2.0",
"extends_custom": "AbstractionModel",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""

View File

@ -0,0 +1,47 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Extractor (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler\JoomlaPower**
> extends: **ExtendingExtractor**
```uml
@startuml
class Extractor << (F,LightGreen) >> #RoyalBlue {
# string $table
# $targetVersion
+ __construct(int $targetVersion)
# namespaces(array $guids) : ?array
}
note right of Extractor::__construct
Constructor.
since: 3.2.1
end note
note right of Extractor::namespaces
Get the complete namespace strings of the guids passed as an array.
since: 3.2.0
return: ?array
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,119 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\JoomlaPower;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power\ExtractorInterface;
use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor as ExtendingExtractor;
/**
* Compiler Joomla Power Extractor
* @since 3.2.1
*/
final class Extractor extends ExtendingExtractor implements ExtractorInterface
{
/**
* The pattern to get the powers
*
* @var string
* @since 3.2.0
**/
protected string $pattern = '/Joomla_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
/**
* The pattern to get the Front
*
* @var string
* @since 3.2.1
**/
protected string $_pattern = 'Joomla';
/**
* The pattern to get the Back
*
* @var string
* @since 3.2.1
**/
protected string $pattern_ = 'Power';
/**
* The Table
*
* @var string
* @since 3.2.1
**/
protected string $table = 'joomla_power';
/**
* Current Joomla Version Being Build
*
* @var int
* @since 3.2.0
**/
protected $targetVersion;
/**
* Constructor.
*
* @param int $targetVersion The targeted Joomla version.
*
* @since 3.2.1
*/
public function __construct(int $targetVersion)
{
parent::__construct();
$this->targetVersion = $targetVersion;
}
/**
* Get the complete namespace strings of the guids passed as an array.
*
* @param array $guids The guids to filter the results
*
* @return array|null The result namespaces with their guids
* @since 3.2.0
**/
protected function namespaces(array $guids): ?array
{
$query = $this->db->getQuery(true);
$query->select($this->db->quoteName(['settings', 'guid']))
->from($this->db->quoteName('#__componentbuilder_' . $this->table))
->where($this->db->quoteName('guid') . ' IN (' . implode(',', array_map([$this->db, 'quote'], $guids)) . ')');
$this->db->setQuery($query);
$this->db->execute();
if ($this->db->getNumRows())
{
$namespaces = [];
$items = $this->db->loadAssocList();
foreach ($items as $item)
{
if (JsonHelper::check($item->settings))
{
$item->settings = json_decode($item->settings, true);
echo '<pre>'; var_dump($item->settings, 'Joomla Version: ' . $this->targetVersion); exit;
}
}
if ($namespaces !== [])
{
return $namespaces;
}
}
return null;
}
}

View File

@ -0,0 +1,92 @@
/**
* The pattern to get the powers
*
* @var string
* @since 3.2.0
**/
protected string $pattern = '/Joomla_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
/**
* The pattern to get the Front
*
* @var string
* @since 3.2.1
**/
protected string $_pattern = 'Joomla';
/**
* The pattern to get the Back
*
* @var string
* @since 3.2.1
**/
protected string $pattern_ = 'Power';
/**
* The Table
*
* @var string
* @since 3.2.1
**/
protected string $table = 'joomla_power';
/**
* Current Joomla Version Being Build
*
* @var int
* @since 3.2.0
**/
protected $targetVersion;
/**
* Constructor.
*
* @param int $targetVersion The targeted Joomla version.
*
* @since 3.2.1
*/
public function __construct(int $targetVersion)
{
parent::__construct();
$this->targetVersion = $targetVersion;
}
/**
* Get the complete namespace strings of the guids passed as an array.
*
* @param array $guids The guids to filter the results
*
* @return array|null The result namespaces with their guids
* @since 3.2.0
**/
protected function namespaces(array $guids): ?array
{
$query = $this->db->getQuery(true);
$query->select($this->db->quoteName(['settings', 'guid']))
->from($this->db->quoteName('#__componentbuilder_' . $this->table))
->where($this->db->quoteName('guid') . ' IN (' . implode(',', array_map([$this->db, 'quote'], $guids)) . ')');
$this->db->setQuery($query);
$this->db->execute();
if ($this->db->getNumRows())
{
$namespaces = [];
$items = $this->db->loadAssocList();
foreach ($items as $item)
{
if (JsonHelper::check($item->settings))
{
$item->settings = json_decode($item->settings, true);
echo '<pre>'; var_dump($item->settings, 'Joomla Version: ' . $this->targetVersion); exit;
}
}
if ($namespaces !== [])
{
return $namespaces;
}
}
return null;
}

View File

@ -0,0 +1,25 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "eeb03266-22fd-45bb-953a-961bb6be3a54",
"guid": "82505f3f-297f-4d75-a581-929ab3e93689",
"implements": [
"c159425c-51f9-4a15-af99-f2d0c6d7aae8"
],
"load_selection": null,
"name": "Extractor",
"power_version": "1.0.0",
"system_name": "JCB.Compiler.JoomlaPower.Extractor",
"type": "final class",
"use_selection": {
"use_selection0": {
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.JoomlaPower.Extractor",
"description": "Compiler Joomla Power Extractor\r\n@since 3.2.1",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,38 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Upsert (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Model**
> extends: **ExtendingUpsert**
```uml
@startuml
class Upsert << (F,LightGreen) >> #RoyalBlue {
# getTable() : string
}
note right of Upsert::getTable
Get the current active table
since: 3.2.0
return: string
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,38 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Model;
use VDM\Joomla\Interfaces\ModelInterface;
use VDM\Joomla\Componentbuilder\Power\Model\Upsert as ExtendingUpsert;
/**
* Joomla Power Model Update or Insert
*
* @since 3.2.0
*/
final class Upsert extends ExtendingUpsert implements ModelInterface
{
/**
* Get the current active table
*
* @return string
* @since 3.2.0
*/
protected function getTable(): string
{
return 'joomla_power';
}
}

View File

@ -0,0 +1,10 @@
/**
* Get the current active table
*
* @return string
* @since 3.2.0
*/
protected function getTable(): string
{
return 'joomla_power';
}

Some files were not shown because too many files have changed in this diff Show More