Compare commits

..

5 Commits

Author SHA1 Message Date
df16b2e3ad Fix the update server #978 issue. Fixed the change log to load all entries, not just the last one. Fixed #983 so that database updates are created when adding a new adminview. Moved a few builder arrays to the Compiler Registry. Adds super powers to JCB. Adds Gitea API library. Improves Power filters. Fix #991 to add the Utilities service class. Adds Superpower Key (SPK) replacement feature. Adds Superpower search (GREP) feature. Adds Power Insert/Update Classe. Fix #995 that all update sites are using the correct URL. 2023-05-02 02:10:55 +02:00
d6c73987f5 Updated the Support and Contribution info. 2023-02-27 14:33:19 +02:00
737bd03e46 Stable release of v3.1.19
We fixed #972 so that custom code (in the header) will be added after the power namespaces. We added a message to show when a server move failed. We fixed the BaseConfig to not use '_' as separator. We fixed the footable loading issue. We removed the need for passing placeholders by reference. We added the option to generate a CHANGELOG. We fixed the server class to load new client if server details changed. We fixed the readme placeholder issue #978. We fixed the empty server url issue #978. Fixed Package import to now use the phplibsec version 3.
2023-02-27 14:27:41 +02:00
339aec221e Moves all major structre function to container. Adds new Server replacment class for legacy calls. Refactored multiple classes. Add more advanced compiler options, with donation notice. 2023-02-12 21:15:41 +02:00
7fa8964b44 Fixed alias builder #973 2023-02-06 13:28:45 +02:00
312 changed files with 31610 additions and 7224 deletions

View File

@ -1,24 +1,17 @@
Contributing to the Joomla Component Builder (JCB)
===============
You are welcome to submit a contribution for review and possible inclusion in the Joomla Component Builder but, before it will be accepted, we ask that you follow these simple steps:
If you wish to submit a contribution for review and potential inclusion in the Joomla Component Builder (JCB), please follow these simple steps:
1) Please watch [these tutorials][Tutorials]
1) Open an issue on GitHub, and if possible, provide a fix and create a pull request (PR). Creating a PR automatically generates an issue so that you do not need to create one separately.
2) Open an issue on GitHub. If you can, please provide a fix and create a pull request (PR) instead; this will automatically create an issue for you so you do not have to create an issue if you are creating a pull request.
2) Adhere to the [Joomla! Coding Standards](https://developer.joomla.org/coding-standards.html).
3) Follow the [Joomla! Coding Standards][Standards].
3) When filing an issue or opening a PR, provide a clear and concise title and description. The title should include a brief summary of the issue and reference to an open issue if possible. For example, Invalid Query in com_admin (Ref #1234) is sufficient. Additionally, provide a detailed description of the issue or PR, including what the problem is, what the PR is addressing, testing instructions, and environmental information such as PHP version and database driver and version, in case the issue is specific to certain environments.
4) When filing an issue or opening a PR, please include a clear title and description. The title should be a short summary of an issue and, if possible, should include a reference to an open issue. For example, `Invalid Query in com_admin (Ref #1234)` would be sufficient. All issues and PRs should include a description with as much detail as possible.
If it is a PR, include what the issue is, what the PR is addressing, testing instructions and environmental information (PHP version, database driver and version, and other data you can retrieve from your site's system information view) in case the issue is specific to certain environments. If additional information is needed, please be prepared to provide it as our community members review your submission.
4) Report security issues to the JCB! Core Team using the [Report security issues contact form](https://www.vdm.io/report-security-issues) instead of using public forums.
5) Report security issues to the JCB! Core Team using the [Report security issues contact form][Security]. Please do not use the public forums for security issues.
Please be patient as not all items will be tested immediately (remember, all bug testing for the JCB is done by volunteers) and be receptive to feedback about your code.
Please be patient, as not all items will be immediately tested since all bug testing for the JCB is performed by volunteers. Additionally, be open to feedback regarding your code.
#### Branches
PRs should usually be made to the `staging` branch as this contains the most recent version of the code.
[Tutorials]: https://www.youtube.com/watch?v=lLOfx9YA7VQ&list=PLQRGFI8XZ_wsfz3NdKawCiYsALuZ-GhwJ
[Standards]: https://developer.joomla.org/coding-standards.html\
[Security]: http://joomlacomponentbuilder.com/report-security-issues
For PRs, submit to the staging branch as it contains the most up-to-date version of the code.

39
.github/SUPPORT.md vendored
View File

@ -1,27 +1,22 @@
Where can you get support and help?
====================
+ [The JCB Tutorials][Tutorials]
+ [Hello World Tutorial][HelloWorld]
+ [The JCB! Wiki][Wiki]
+ [JCB Forum][forum]
+ [Report a Security Issue][Security]
+ [Community Complaint][Complaint]
+ [Open Issue On Github][Issue] ^^
- [Package](https://git.vdm.dev/joomla/pkg-component-builder).
- [Download](https://git.vdm.dev/joomla/pkg-component-builder/archive/master.zip).
- [Tutorials](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE).
- [German](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wu0tDFxJtZFwW7AxA4JHQV7).
- [Hello World](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45).
- [Discussions](https://github.com/vdm-io/Joomla-Component-Builder/discussions).
- [Wiki](https://git.vdm.dev/joomla/Component-Builder/wiki).
- [Issues](https://git.vdm.dev/joomla/Component-Builder/issues). ^^
- [Issues Stream](https://t.me/jcb_issues).
- [Updates](https://t.me/jcb_updates).
- [User Group](https://t.me/jcb_group).
- [Announcement](https://t.me/Joomla_component_builder).
- [Beta](https://git.vdm.dev/joomla-beta/pkg-component-builder).
- [Nightly Build](https://git.vdm.dev/joomla-beta/pkg-component-builder/archive/master.zip).
- [Community Complaint](https://www.joomlacomponentbuilder.com/community-complaint).
- [Security](https://www.vdm.io/report-security-issues).
Since JCB has become a community project [VDM.io][VDM] is **no longer solely responsible** for support.
We have started a [**JCB forum**][forum] where you can post questions, about how things work, or if you need some kind of help in relation to your development of your components.
^^ Then if you run into any issues, related to the JCB code, like bugs, **start by searching** the (*open & closed*) [issues][Issue] over on Github, and if the issue has not been mentioned before, **then only** open a new issue, following the [community guidelines][guidelines].
[Tutorials]: https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE
[HelloWorld]: https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45
[Wiki]: https://git.vdm.dev/joomla/Component-Builder/wiki
[forum]: https://vdm.bz/jcb-forum
[Security]: http://joomlacomponentbuilder.com/report-security-issues
[Complaint]: http://joomlacomponentbuilder.com/community-complaint
[Issue]: https://git.vdm.dev/joomla/Component-Builder/issues
[VDM]: https://www.vdm.io/joomla-component-builder
[guidelines]: https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/CONTRIBUTING.md
^^ Then if you run into any issues, related to the [JCB](https://git.vdm.dev/joomla/Component-Builder/issues) code, like bugs, **start by searching** the (*open & closed*) issues over on [Gitea](https://git.vdm.dev/joomla/Component-Builder/issues), and if the issue has not been mentioned before, **then only** open a new issue, following the [community guidelines](https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/CONTRIBUTING.md).

27
CHANGELOG.md Normal file
View File

@ -0,0 +1,27 @@
# v3.1.19
- We fixed #972 so that custom code (in the header) will be added after the power namespaces
- We added a message to show when a server move failed
- We fixed the BaseConfig to not use '_' as separator
- We fixed the footable loading issue
- We removed the need for passing placeholders by reference
- We added the option to generate a CHANGELOG
- We fixed the server class to load new client if server details changed.
- We fixed the readme placeholder issue #978.
- We fixed the empty server url issue #978.
- Fixed Package import to now use the phplibsec version 3
# v3.1.24
- Fix the update server #978 issue.
- Fixed the change log to load all entries, not just the last one.
- Fixed #983 so that database updates are created when adding a new adminview
- Moved a few builder arrays to the Compiler Registry
- Adds super powers to JCB
- Adds Gitea API library
- Improves Power filters
- Fix #991 to add the Utilities service class
- Adds Superpower Key (SPK) replacement feature
- Adds Superpower search (GREP) feature
- Adds Power Insert/Update Classes
- Fix #995 that all update sites are using the correct URL

378
README.md
View File

@ -1,189 +1,193 @@
# Joomla Component Builder ([JCB](https://www.joomlacomponentbuilder.com))
# Joomla Component Builder ([JCB](https://www.joomlacomponentbuilder.com))
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/admin/assets/images/jcb-banner.jpg "The Component Builder")
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.24) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
Once installed upgrades are quick and easy via the default [Joomla](https://extensions.joomla.org/extension/component-builder/) upgrade area.
Some of the Features
====================
+ Fetch Code from IDE and place it back in component during next compilation.
+ Add [Joomla custom fields](https://www.youtube.com/watch?v=n5RBmP0uNCM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=75) in any of your components.
+ Add you [own dashboard](https://www.youtube.com/watch?v=tU7TeYn1Djo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=60) in the back-end.
+ [Dynamic File and Folder](https://www.youtube.com/watch?v=_c7wzW075lA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=56) Inclusion concept.
+ [Easy Translation](https://www.youtube.com/watch?v=q5NwKGnOHoQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=51) via excel.
+ Adding your [own rule validation](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=46) to a field in [JCB](https://www.joomlacomponentbuilder.com)
+ [Automated backup system](https://www.youtube.com/watch?v=GUWZaODo_IM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=40) in [JCB](https://www.joomlacomponentbuilder.com).
+ Adding mySQL Dump to any View/Table.
+ Grab existing Table data and build a dynamic dump.
+ Unlimited [Joomla](https://extensions.joomla.org/extension/component-builder/) Components.
+ Unlimited Tables/Views.
+ Reusing Views and Fields.
+ Runs on Your Own [Joomla](https://extensions.joomla.org/extension/component-builder/) Install.
+ Add Dynamic/custom back-end views that uses Table and Chart result sets.
+ Build data query of extreme complex nature to use in Dynamic/custom views.
+ Highly Dynamic/custom Front-end Structures.
+ Dynamically setup templates and layouts for Front-end design.
+ Integration of the excellent UIKIT lib.
+ Integration of the excellent FOOTABLE lib.
+ All [Joomla](https://extensions.joomla.org/extension/component-builder/) Standard Field Types (including subforms).
+ Strong Implementation of all [Joomla](https://extensions.joomla.org/extension/component-builder/) Form Security.
+ Load data via ajax with ease.
+ You can add an Update Server to Components you build.
+ Build advanced Dynamic front-end forms.
+ Dynamic data queries from multiple tables.
+ Place in local GIT folder, and publish to sales server.
+ Include any amount of custom files and folders during build.
+ Static helper class with smart methods already included.
+ Static helper methods Can easily be added.
+ Direct install from compiler view.
+ Integrative with native [Joomla](https://extensions.joomla.org/extension/component-builder/) Categories and Tags.
+ Fully Dynamic Search Friendly URL Auto Implementation.
+ Custom scripting options all over the MVC structure.
+ Permission implementation down to each view, item and field.
+ Easy extendible to include other libraries.
+ Can include SQL and visioning update link to distribute your component updates via [Joomla](https://extensions.joomla.org/extension/component-builder/) default upgrade of components.
+ Easy Export & Import addon to all backend-tables.
+ Overriding ability of import concepts in all backend-tables.
+ The Batch and Filter implementation on all backend-list views.
+ This and much much more are all possible with this component builder!
Just Imagine
====================
+ Your Component Back-end can be more advanced then the [Joomla](https://extensions.joomla.org/extension/component-builder/) Article Manager.
+ Your Code as Perfectly Unified to the strict [Joomla](https://extensions.joomla.org/extension/component-builder/) Standards.
+ Adding Custom Scripting almost anywhere in the MVC structure.
+ Import and export feature to all backend-views.
+ Batch copy and move/update feature for all backend-views.
+ History tracking per/change made on any back-end item.
+ Dynamic field control, to show and hide fields in amazing ways.
+ Front-end freedom of design that allows for any library to be used.
+ This and much much more are all possible with this component builder!
You are in Control
====================
+ You can change the licensing template for your components.
+ You can change/improve existing field types and add more.
+ Line numbers to show where in compiler was the code build.
+ You can improve the component since all code are open-source.
+ Free updates for the lifetime of the project.
+ You can dynamically add internal help structures to all component.
+ There is no limitations on how big or how much you want to build (server limitation only).
+ This is a complete factory kind of component that functions like a deployment hub.
+ Export any component completely mapped in [JCB](https://www.joomlacomponentbuilder.com) and import into another [JCB](https://www.joomlacomponentbuilder.com).
+ This and much much more are all possible with this component builder!
Get More Demo Content
====================
> You can now get access to the WOW factor, [JCB](https://www.joomlacomponentbuilder.com) fully mapped can now be yours! Including many other [JCB](https://www.joomlacomponentbuilder.com) mapped components.
### All you need to do is [explained here](https://vdm.bz/how-to-get-free-vdm-package-keys)!
To install these packages [watch this tutorial](https://vdm.bz/how-to-install-jcb-packages).
Where can you get support and help?
====================
- [Package](https://git.vdm.dev/joomla/pkg-component-builder).
- [Download](https://git.vdm.dev/joomla/pkg-component-builder/archive/master.zip).
- [Tutorials](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE).
- [German](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wu0tDFxJtZFwW7AxA4JHQV7).
- [Hello World](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45).
- [Discussions](https://github.com/vdm-io/Joomla-Component-Builder/discussions).
- [Wiki](https://git.vdm.dev/joomla/Component-Builder/wiki).
- [Issues](https://git.vdm.dev/joomla/Component-Builder/issues). ^^
- [Issues Stream](https://t.me/jcb_issues).
- [Updates](https://t.me/jcb_updates).
- [User Group](https://t.me/jcb_group).
- [Announcement](https://t.me/Joomla_component_builder).
- [Beta](https://git.vdm.dev/joomla-beta/pkg-component-builder).
- [Nightly Build](https://git.vdm.dev/joomla-beta/pkg-component-builder/archive/master.zip).
- [Community Complaint](https://www.joomlacomponentbuilder.com/community-complaint).
- [Security](https://www.vdm.io/report-security-issues).
^^ Then if you run into any issues, related to the [JCB](https://git.vdm.dev/joomla/Component-Builder/issues) code, like bugs, **start by searching** the (*open & closed*) issues over on [Gitea](https://git.vdm.dev/joomla/Component-Builder/issues), and if the issue has not been mentioned before, **then only** open a new issue, following the [community guidelines](https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/CONTRIBUTING.md).
WHY GIVE IT AWAY LIKE THIS?
====================
> We are Open Source Enthusiast
> Who Support the [Joomla](https://extensions.joomla.org/extension/component-builder/) Community
Our idea was to almost let this tool serve as a cheat sheet to how things can be done... and with the help of other developers end up formulating the way how things not only can, but must be done to insure secure, stable, scalable and maintainable code is produced.
MAKING IT BETTER!
====================
Get involved on the forums, and the Gitea issues, and you can even help us develop/improve the pipeline of [JCB](https://www.joomlacomponentbuilder.com) for continues delivery. We really want to see [JCB](https://www.joomlacomponentbuilder.com) remain the tool of choice for all [Joomla Component Development](https://extensions.joomla.org/extension/component-builder/) needs and ideas.
TODO
======
- Add automatic unit testing. To nurture pipeline integration for all components build with [JCB](https://www.joomlacomponentbuilder.com).
- Team collaborative development across [JCB](https://www.joomlacomponentbuilder.com) installations offline and online.
- Documentation (maintained by the community) for [JCB](https://www.joomlacomponentbuilder.com). (help us select the best system for this)
# Build Details
+ *Community*: [Vast Development Method](https://dev.vdm.io)
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 2nd May, 2023
+ *Version*: 3.1.24
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **557762**
+ *Field count*: **2041**
+ *File count*: **3930**
+ *Folder count*: **432**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/admin/assets/images/jcb-banner.jpg "The Component Builder")
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.13) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
Once installed upgrades are quick and easy via the default [Joomla](https://extensions.joomla.org/extension/component-builder/) upgrade area.
Some of the Features
====================
+ Fetch Code from IDE and place it back in component during next compilation.
+ Add [Joomla custom fields](https://www.youtube.com/watch?v=n5RBmP0uNCM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=75) in any of your components.
+ Add you [own dashboard](https://www.youtube.com/watch?v=tU7TeYn1Djo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=60) in the back-end.
+ [Dynamic File and Folder](https://www.youtube.com/watch?v=_c7wzW075lA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=56) Inclusion concept.
+ [Easy Translation](https://www.youtube.com/watch?v=q5NwKGnOHoQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=51) via excel.
+ Adding your [own rule validation](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=46) to a field in [JCB](https://www.joomlacomponentbuilder.com)
+ [Automated backup system](https://www.youtube.com/watch?v=GUWZaODo_IM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=40) in [JCB](https://www.joomlacomponentbuilder.com).
+ Adding mySQL Dump to any View/Table.
+ Grab existing Table data and build a dynamic dump.
+ Unlimited [Joomla](https://extensions.joomla.org/extension/component-builder/) Components.
+ Unlimited Tables/Views.
+ Reusing Views and Fields.
+ Runs on Your Own [Joomla](https://extensions.joomla.org/extension/component-builder/) Install.
+ Add Dynamic/custom back-end views that uses Table and Chart result sets.
+ Build data query of extreme complex nature to use in Dynamic/custom views.
+ Highly Dynamic/custom Front-end Structures.
+ Dynamically setup templates and layouts for Front-end design.
+ Integration of the excellent UIKIT lib.
+ Integration of the excellent FOOTABLE lib.
+ All [Joomla](https://extensions.joomla.org/extension/component-builder/) Standard Field Types (including subforms).
+ Strong Implementation of all [Joomla](https://extensions.joomla.org/extension/component-builder/) Form Security.
+ Load data via ajax with ease.
+ You can add an Update Server to Components you build.
+ Build advanced Dynamic front-end forms.
+ Dynamic data queries from multiple tables.
+ Place in local GIT folder, and publish to sales server.
+ Include any amount of custom files and folders during build.
+ Static helper class with smart methods already included.
+ Static helper methods Can easily be added.
+ Direct install from compiler view.
+ Integrative with native [Joomla](https://extensions.joomla.org/extension/component-builder/) Categories and Tags.
+ Fully Dynamic Search Friendly URL Auto Implementation.
+ Custom scripting options all over the MVC structure.
+ Permission implementation down to each view, item and field.
+ Easy extendible to include other libraries.
+ Can include SQL and visioning update link to distribute your component updates via [Joomla](https://extensions.joomla.org/extension/component-builder/) default upgrade of components.
+ Easy Export & Import addon to all backend-tables.
+ Overriding ability of import concepts in all backend-tables.
+ The Batch and Filter implementation on all backend-list views.
+ This and much much more are all possible with this component builder!
Just Imagine
====================
+ Your Component Back-end can be more advanced then the [Joomla](https://extensions.joomla.org/extension/component-builder/) Article Manager.
+ Your Code as Perfectly Unified to the strict [Joomla](https://extensions.joomla.org/extension/component-builder/) Standards.
+ Adding Custom Scripting almost anywhere in the MVC structure.
+ Import and export feature to all backend-views.
+ Batch copy and move/update feature for all backend-views.
+ History tracking per/change made on any back-end item.
+ Dynamic field control, to show and hide fields in amazing ways.
+ Front-end freedom of design that allows for any library to be used.
+ This and much much more are all possible with this component builder!
You are in Control
====================
+ You can change the licensing template for your components.
+ You can change/improve existing field types and add more.
+ Line numbers to show where in compiler was the code build.
+ You can improve the component since all code are open-source.
+ Free updates for the lifetime of the project.
+ You can dynamically add internal help structures to all component.
+ There is no limitations on how big or how much you want to build (server limitation only).
+ This is a complete factory kind of component that functions like a deployment hub.
+ Export any component completely mapped in [JCB](https://www.joomlacomponentbuilder.com) and import into another [JCB](https://www.joomlacomponentbuilder.com).
+ This and much much more are all possible with this component builder!
Get More Demo Content
====================
> You can now get access to the WOW factor, [JCB](https://www.joomlacomponentbuilder.com) fully mapped can now be yours! Including many other [JCB](https://www.joomlacomponentbuilder.com) mapped components.
### All you need to do is [explained here](https://vdm.bz/how-to-get-free-vdm-package-keys)!
To install these packages [watch this tutorial](https://vdm.bz/how-to-install-jcb-packages).
Where can you get support and help?
====================
+ [The JCB Tutorials](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE)
+ [German Basic Introduction](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wu0tDFxJtZFwW7AxA4JHQV7)
+ [Hello World Tutorial](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
+ [The JCB! Wiki](https://git.vdm.dev/joomla/Component-Builder/wiki)
+ [Forum](https://vdm.bz/jcb-forum)
+ [Report a Security Issue](https://www.joomlacomponentbuilder.com/report-security-issues)
+ [Community Complaint](https://www.joomlacomponentbuilder.com/community-complaint)
+ [Open Issue On Gitea](https://git.vdm.dev/joomla/Component-Builder/issues) ^^
Since [JCB](https://www.joomlacomponentbuilder.com) has [become a community](https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/SUPPORT.md) project [VDM.io](https://www.vdm.io/) is **no longer solely responsible** for support.
We have started a [**JCB forum**](https://vdm.bz/jcb-forum) where you can post questions, about how things work, or if you need some kind of help in relation to your development of your components.
^^ Then if you run into any issues, related to the [JCB](https://git.vdm.dev/joomla/Component-Builder/issues) code, like bugs, **start by searching** the (*open & closed*) issues over on [Gitea](https://git.vdm.dev/joomla/Component-Builder/issues), and if the issue has not been mentioned before, **then only** open a new issue, following the [community guidelines](https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/CONTRIBUTING.md).
WHY GIVE IT AWAY LIKE THIS?
====================
> We are Open Source Enthusiast
> Who Support the [Joomla](https://extensions.joomla.org/extension/component-builder/) Community
Our idea was to almost let this tool serve as a cheat sheet to how things can be done... and with the help of other developers end up formulating the way how things not only can, but must be done to insure secure, stable, scalable and maintainable code is produced.
MAKING IT BETTER!
====================
Get involved on the forums, and the Gitea issues, and you can even help us develop/improve the pipeline of [JCB](https://www.joomlacomponentbuilder.com) for continues delivery. We really want to see [JCB](https://www.joomlacomponentbuilder.com) remain the tool of choice for all [Joomla Component Development](https://extensions.joomla.org/extension/component-builder/) needs and ideas.
TODO
======
- Add automatic unit testing. To nurture pipeline integration for all components build with [JCB](https://www.joomlacomponentbuilder.com).
- Team collaborative development across [JCB](https://www.joomlacomponentbuilder.com) installations offline and online.
- Documentation (maintained by the community) for [JCB](https://www.joomlacomponentbuilder.com). (help us select the best system for this)
# Build Details
+ *Community*: [Vast Development Method](https://dev.vdm.io)
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 29th January, 2023
+ *Version*: 3.1.13
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **360674**
+ *Field count*: **2009**
+ *File count*: **2314**
+ *Folder count*: **408**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
## Contributors
This project exists thanks to all the people who contribute to the [Joomla Component Builder Project](https://github.com/vdm-io/Joomla-Component-Builder).
[![Contributors](https://opencollective.com/Joomla-Component-Builder/contributors.svg?width=890&button=false)](https://github.com/vdm-io/Joomla-Component-Builder/graphs/contributors)
### Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Joomla-Component-Builder#backer)]
[![Our Backers on opencollective](https://opencollective.com/Joomla-Component-Builder/backers.svg?width=890)](https://opencollective.com/Joomla-Component-Builder#backers)
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Joomla-Component-Builder#sponsor)]
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/0/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/0/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/1/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/1/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/2/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/2/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/3/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/3/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/4/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/4/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/5/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/5/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/6/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/6/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/7/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/7/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/8/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/8/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/10/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/10/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/11/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/11/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/12/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/12/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/13/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/13/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/14/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/14/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/15/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/15/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/16/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/16/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/17/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/17/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/18/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/18/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/19/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/19/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/20/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/20/website)
## Contributors
This project exists thanks to all the people who contribute to the [Joomla Component Builder Project](https://github.com/vdm-io/Joomla-Component-Builder).
[![Contributors](https://opencollective.com/Joomla-Component-Builder/contributors.svg?width=890&button=false)](https://github.com/vdm-io/Joomla-Component-Builder/graphs/contributors)
### Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Joomla-Component-Builder#backer)]
[![Our Backers on opencollective](https://opencollective.com/Joomla-Component-Builder/backers.svg?width=890)](https://opencollective.com/Joomla-Component-Builder#backers)
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Joomla-Component-Builder#sponsor)]
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/0/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/0/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/1/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/1/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/2/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/2/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/3/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/3/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/4/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/4/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/5/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/5/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/6/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/6/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/7/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/7/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/8/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/8/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/10/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/10/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/11/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/11/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/12/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/12/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/13/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/13/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/14/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/14/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/15/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/15/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/16/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/16/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/17/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/17/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/18/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/18/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/19/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/19/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/20/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/20/website)

View File

@ -1,189 +1,193 @@
# Joomla Component Builder ([JCB](https://www.joomlacomponentbuilder.com))
# Joomla Component Builder ([JCB](https://www.joomlacomponentbuilder.com))
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/admin/assets/images/jcb-banner.jpg "The Component Builder")
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.24) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
Once installed upgrades are quick and easy via the default [Joomla](https://extensions.joomla.org/extension/component-builder/) upgrade area.
Some of the Features
====================
+ Fetch Code from IDE and place it back in component during next compilation.
+ Add [Joomla custom fields](https://www.youtube.com/watch?v=n5RBmP0uNCM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=75) in any of your components.
+ Add you [own dashboard](https://www.youtube.com/watch?v=tU7TeYn1Djo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=60) in the back-end.
+ [Dynamic File and Folder](https://www.youtube.com/watch?v=_c7wzW075lA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=56) Inclusion concept.
+ [Easy Translation](https://www.youtube.com/watch?v=q5NwKGnOHoQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=51) via excel.
+ Adding your [own rule validation](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=46) to a field in [JCB](https://www.joomlacomponentbuilder.com)
+ [Automated backup system](https://www.youtube.com/watch?v=GUWZaODo_IM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=40) in [JCB](https://www.joomlacomponentbuilder.com).
+ Adding mySQL Dump to any View/Table.
+ Grab existing Table data and build a dynamic dump.
+ Unlimited [Joomla](https://extensions.joomla.org/extension/component-builder/) Components.
+ Unlimited Tables/Views.
+ Reusing Views and Fields.
+ Runs on Your Own [Joomla](https://extensions.joomla.org/extension/component-builder/) Install.
+ Add Dynamic/custom back-end views that uses Table and Chart result sets.
+ Build data query of extreme complex nature to use in Dynamic/custom views.
+ Highly Dynamic/custom Front-end Structures.
+ Dynamically setup templates and layouts for Front-end design.
+ Integration of the excellent UIKIT lib.
+ Integration of the excellent FOOTABLE lib.
+ All [Joomla](https://extensions.joomla.org/extension/component-builder/) Standard Field Types (including subforms).
+ Strong Implementation of all [Joomla](https://extensions.joomla.org/extension/component-builder/) Form Security.
+ Load data via ajax with ease.
+ You can add an Update Server to Components you build.
+ Build advanced Dynamic front-end forms.
+ Dynamic data queries from multiple tables.
+ Place in local GIT folder, and publish to sales server.
+ Include any amount of custom files and folders during build.
+ Static helper class with smart methods already included.
+ Static helper methods Can easily be added.
+ Direct install from compiler view.
+ Integrative with native [Joomla](https://extensions.joomla.org/extension/component-builder/) Categories and Tags.
+ Fully Dynamic Search Friendly URL Auto Implementation.
+ Custom scripting options all over the MVC structure.
+ Permission implementation down to each view, item and field.
+ Easy extendible to include other libraries.
+ Can include SQL and visioning update link to distribute your component updates via [Joomla](https://extensions.joomla.org/extension/component-builder/) default upgrade of components.
+ Easy Export & Import addon to all backend-tables.
+ Overriding ability of import concepts in all backend-tables.
+ The Batch and Filter implementation on all backend-list views.
+ This and much much more are all possible with this component builder!
Just Imagine
====================
+ Your Component Back-end can be more advanced then the [Joomla](https://extensions.joomla.org/extension/component-builder/) Article Manager.
+ Your Code as Perfectly Unified to the strict [Joomla](https://extensions.joomla.org/extension/component-builder/) Standards.
+ Adding Custom Scripting almost anywhere in the MVC structure.
+ Import and export feature to all backend-views.
+ Batch copy and move/update feature for all backend-views.
+ History tracking per/change made on any back-end item.
+ Dynamic field control, to show and hide fields in amazing ways.
+ Front-end freedom of design that allows for any library to be used.
+ This and much much more are all possible with this component builder!
You are in Control
====================
+ You can change the licensing template for your components.
+ You can change/improve existing field types and add more.
+ Line numbers to show where in compiler was the code build.
+ You can improve the component since all code are open-source.
+ Free updates for the lifetime of the project.
+ You can dynamically add internal help structures to all component.
+ There is no limitations on how big or how much you want to build (server limitation only).
+ This is a complete factory kind of component that functions like a deployment hub.
+ Export any component completely mapped in [JCB](https://www.joomlacomponentbuilder.com) and import into another [JCB](https://www.joomlacomponentbuilder.com).
+ This and much much more are all possible with this component builder!
Get More Demo Content
====================
> You can now get access to the WOW factor, [JCB](https://www.joomlacomponentbuilder.com) fully mapped can now be yours! Including many other [JCB](https://www.joomlacomponentbuilder.com) mapped components.
### All you need to do is [explained here](https://vdm.bz/how-to-get-free-vdm-package-keys)!
To install these packages [watch this tutorial](https://vdm.bz/how-to-install-jcb-packages).
Where can you get support and help?
====================
- [Package](https://git.vdm.dev/joomla/pkg-component-builder).
- [Download](https://git.vdm.dev/joomla/pkg-component-builder/archive/master.zip).
- [Tutorials](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE).
- [German](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wu0tDFxJtZFwW7AxA4JHQV7).
- [Hello World](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45).
- [Discussions](https://github.com/vdm-io/Joomla-Component-Builder/discussions).
- [Wiki](https://git.vdm.dev/joomla/Component-Builder/wiki).
- [Issues](https://git.vdm.dev/joomla/Component-Builder/issues). ^^
- [Issues Stream](https://t.me/jcb_issues).
- [Updates](https://t.me/jcb_updates).
- [User Group](https://t.me/jcb_group).
- [Announcement](https://t.me/Joomla_component_builder).
- [Beta](https://git.vdm.dev/joomla-beta/pkg-component-builder).
- [Nightly Build](https://git.vdm.dev/joomla-beta/pkg-component-builder/archive/master.zip).
- [Community Complaint](https://www.joomlacomponentbuilder.com/community-complaint).
- [Security](https://www.vdm.io/report-security-issues).
^^ Then if you run into any issues, related to the [JCB](https://git.vdm.dev/joomla/Component-Builder/issues) code, like bugs, **start by searching** the (*open & closed*) issues over on [Gitea](https://git.vdm.dev/joomla/Component-Builder/issues), and if the issue has not been mentioned before, **then only** open a new issue, following the [community guidelines](https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/CONTRIBUTING.md).
WHY GIVE IT AWAY LIKE THIS?
====================
> We are Open Source Enthusiast
> Who Support the [Joomla](https://extensions.joomla.org/extension/component-builder/) Community
Our idea was to almost let this tool serve as a cheat sheet to how things can be done... and with the help of other developers end up formulating the way how things not only can, but must be done to insure secure, stable, scalable and maintainable code is produced.
MAKING IT BETTER!
====================
Get involved on the forums, and the Gitea issues, and you can even help us develop/improve the pipeline of [JCB](https://www.joomlacomponentbuilder.com) for continues delivery. We really want to see [JCB](https://www.joomlacomponentbuilder.com) remain the tool of choice for all [Joomla Component Development](https://extensions.joomla.org/extension/component-builder/) needs and ideas.
TODO
======
- Add automatic unit testing. To nurture pipeline integration for all components build with [JCB](https://www.joomlacomponentbuilder.com).
- Team collaborative development across [JCB](https://www.joomlacomponentbuilder.com) installations offline and online.
- Documentation (maintained by the community) for [JCB](https://www.joomlacomponentbuilder.com). (help us select the best system for this)
# Build Details
+ *Community*: [Vast Development Method](https://dev.vdm.io)
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 2nd May, 2023
+ *Version*: 3.1.24
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **557762**
+ *Field count*: **2041**
+ *File count*: **3930**
+ *Folder count*: **432**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/admin/assets/images/jcb-banner.jpg "The Component Builder")
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.1.13) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
Once installed upgrades are quick and easy via the default [Joomla](https://extensions.joomla.org/extension/component-builder/) upgrade area.
Some of the Features
====================
+ Fetch Code from IDE and place it back in component during next compilation.
+ Add [Joomla custom fields](https://www.youtube.com/watch?v=n5RBmP0uNCM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=75) in any of your components.
+ Add you [own dashboard](https://www.youtube.com/watch?v=tU7TeYn1Djo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=60) in the back-end.
+ [Dynamic File and Folder](https://www.youtube.com/watch?v=_c7wzW075lA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=56) Inclusion concept.
+ [Easy Translation](https://www.youtube.com/watch?v=q5NwKGnOHoQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=51) via excel.
+ Adding your [own rule validation](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=46) to a field in [JCB](https://www.joomlacomponentbuilder.com)
+ [Automated backup system](https://www.youtube.com/watch?v=GUWZaODo_IM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=40) in [JCB](https://www.joomlacomponentbuilder.com).
+ Adding mySQL Dump to any View/Table.
+ Grab existing Table data and build a dynamic dump.
+ Unlimited [Joomla](https://extensions.joomla.org/extension/component-builder/) Components.
+ Unlimited Tables/Views.
+ Reusing Views and Fields.
+ Runs on Your Own [Joomla](https://extensions.joomla.org/extension/component-builder/) Install.
+ Add Dynamic/custom back-end views that uses Table and Chart result sets.
+ Build data query of extreme complex nature to use in Dynamic/custom views.
+ Highly Dynamic/custom Front-end Structures.
+ Dynamically setup templates and layouts for Front-end design.
+ Integration of the excellent UIKIT lib.
+ Integration of the excellent FOOTABLE lib.
+ All [Joomla](https://extensions.joomla.org/extension/component-builder/) Standard Field Types (including subforms).
+ Strong Implementation of all [Joomla](https://extensions.joomla.org/extension/component-builder/) Form Security.
+ Load data via ajax with ease.
+ You can add an Update Server to Components you build.
+ Build advanced Dynamic front-end forms.
+ Dynamic data queries from multiple tables.
+ Place in local GIT folder, and publish to sales server.
+ Include any amount of custom files and folders during build.
+ Static helper class with smart methods already included.
+ Static helper methods Can easily be added.
+ Direct install from compiler view.
+ Integrative with native [Joomla](https://extensions.joomla.org/extension/component-builder/) Categories and Tags.
+ Fully Dynamic Search Friendly URL Auto Implementation.
+ Custom scripting options all over the MVC structure.
+ Permission implementation down to each view, item and field.
+ Easy extendible to include other libraries.
+ Can include SQL and visioning update link to distribute your component updates via [Joomla](https://extensions.joomla.org/extension/component-builder/) default upgrade of components.
+ Easy Export & Import addon to all backend-tables.
+ Overriding ability of import concepts in all backend-tables.
+ The Batch and Filter implementation on all backend-list views.
+ This and much much more are all possible with this component builder!
Just Imagine
====================
+ Your Component Back-end can be more advanced then the [Joomla](https://extensions.joomla.org/extension/component-builder/) Article Manager.
+ Your Code as Perfectly Unified to the strict [Joomla](https://extensions.joomla.org/extension/component-builder/) Standards.
+ Adding Custom Scripting almost anywhere in the MVC structure.
+ Import and export feature to all backend-views.
+ Batch copy and move/update feature for all backend-views.
+ History tracking per/change made on any back-end item.
+ Dynamic field control, to show and hide fields in amazing ways.
+ Front-end freedom of design that allows for any library to be used.
+ This and much much more are all possible with this component builder!
You are in Control
====================
+ You can change the licensing template for your components.
+ You can change/improve existing field types and add more.
+ Line numbers to show where in compiler was the code build.
+ You can improve the component since all code are open-source.
+ Free updates for the lifetime of the project.
+ You can dynamically add internal help structures to all component.
+ There is no limitations on how big or how much you want to build (server limitation only).
+ This is a complete factory kind of component that functions like a deployment hub.
+ Export any component completely mapped in [JCB](https://www.joomlacomponentbuilder.com) and import into another [JCB](https://www.joomlacomponentbuilder.com).
+ This and much much more are all possible with this component builder!
Get More Demo Content
====================
> You can now get access to the WOW factor, [JCB](https://www.joomlacomponentbuilder.com) fully mapped can now be yours! Including many other [JCB](https://www.joomlacomponentbuilder.com) mapped components.
### All you need to do is [explained here](https://vdm.bz/how-to-get-free-vdm-package-keys)!
To install these packages [watch this tutorial](https://vdm.bz/how-to-install-jcb-packages).
Where can you get support and help?
====================
+ [The JCB Tutorials](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE)
+ [German Basic Introduction](https://www.youtube.com/playlist?list=PLQRGFI8XZ_wu0tDFxJtZFwW7AxA4JHQV7)
+ [Hello World Tutorial](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
+ [The JCB! Wiki](https://git.vdm.dev/joomla/Component-Builder/wiki)
+ [Forum](https://vdm.bz/jcb-forum)
+ [Report a Security Issue](https://www.joomlacomponentbuilder.com/report-security-issues)
+ [Community Complaint](https://www.joomlacomponentbuilder.com/community-complaint)
+ [Open Issue On Gitea](https://git.vdm.dev/joomla/Component-Builder/issues) ^^
Since [JCB](https://www.joomlacomponentbuilder.com) has [become a community](https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/SUPPORT.md) project [VDM.io](https://www.vdm.io/) is **no longer solely responsible** for support.
We have started a [**JCB forum**](https://vdm.bz/jcb-forum) where you can post questions, about how things work, or if you need some kind of help in relation to your development of your components.
^^ Then if you run into any issues, related to the [JCB](https://git.vdm.dev/joomla/Component-Builder/issues) code, like bugs, **start by searching** the (*open & closed*) issues over on [Gitea](https://git.vdm.dev/joomla/Component-Builder/issues), and if the issue has not been mentioned before, **then only** open a new issue, following the [community guidelines](https://git.vdm.dev/joomla/Component-Builder/src/branch/master/.github/CONTRIBUTING.md).
WHY GIVE IT AWAY LIKE THIS?
====================
> We are Open Source Enthusiast
> Who Support the [Joomla](https://extensions.joomla.org/extension/component-builder/) Community
Our idea was to almost let this tool serve as a cheat sheet to how things can be done... and with the help of other developers end up formulating the way how things not only can, but must be done to insure secure, stable, scalable and maintainable code is produced.
MAKING IT BETTER!
====================
Get involved on the forums, and the Gitea issues, and you can even help us develop/improve the pipeline of [JCB](https://www.joomlacomponentbuilder.com) for continues delivery. We really want to see [JCB](https://www.joomlacomponentbuilder.com) remain the tool of choice for all [Joomla Component Development](https://extensions.joomla.org/extension/component-builder/) needs and ideas.
TODO
======
- Add automatic unit testing. To nurture pipeline integration for all components build with [JCB](https://www.joomlacomponentbuilder.com).
- Team collaborative development across [JCB](https://www.joomlacomponentbuilder.com) installations offline and online.
- Documentation (maintained by the community) for [JCB](https://www.joomlacomponentbuilder.com). (help us select the best system for this)
# Build Details
+ *Community*: [Vast Development Method](https://dev.vdm.io)
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 29th January, 2023
+ *Version*: 3.1.13
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **360674**
+ *Field count*: **2009**
+ *File count*: **2314**
+ *Folder count*: **408**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
## Contributors
This project exists thanks to all the people who contribute to the [Joomla Component Builder Project](https://github.com/vdm-io/Joomla-Component-Builder).
[![Contributors](https://opencollective.com/Joomla-Component-Builder/contributors.svg?width=890&button=false)](https://github.com/vdm-io/Joomla-Component-Builder/graphs/contributors)
### Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Joomla-Component-Builder#backer)]
[![Our Backers on opencollective](https://opencollective.com/Joomla-Component-Builder/backers.svg?width=890)](https://opencollective.com/Joomla-Component-Builder#backers)
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Joomla-Component-Builder#sponsor)]
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/0/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/0/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/1/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/1/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/2/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/2/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/3/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/3/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/4/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/4/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/5/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/5/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/6/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/6/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/7/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/7/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/8/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/8/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/10/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/10/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/11/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/11/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/12/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/12/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/13/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/13/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/14/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/14/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/15/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/15/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/16/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/16/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/17/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/17/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/18/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/18/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/19/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/19/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/20/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/20/website)
## Contributors
This project exists thanks to all the people who contribute to the [Joomla Component Builder Project](https://github.com/vdm-io/Joomla-Component-Builder).
[![Contributors](https://opencollective.com/Joomla-Component-Builder/contributors.svg?width=890&button=false)](https://github.com/vdm-io/Joomla-Component-Builder/graphs/contributors)
### Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Joomla-Component-Builder#backer)]
[![Our Backers on opencollective](https://opencollective.com/Joomla-Component-Builder/backers.svg?width=890)](https://opencollective.com/Joomla-Component-Builder#backers)
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Joomla-Component-Builder#sponsor)]
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/0/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/0/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/1/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/1/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/2/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/2/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/3/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/3/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/4/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/4/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/5/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/5/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/6/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/6/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/7/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/7/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/8/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/8/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/10/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/10/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/11/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/11/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/12/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/12/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/13/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/13/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/14/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/14/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/15/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/15/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/16/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/16/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/17/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/17/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/18/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/18/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/19/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/19/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/20/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/20/website)

View File

@ -483,7 +483,10 @@
<action name="placeholder.export" title="COM_COMPONENTBUILDER_PLACEHOLDERS_EXPORT" description="COM_COMPONENTBUILDER_PLACEHOLDERS_EXPORT_DESC" />
<action name="placeholder.import" title="COM_COMPONENTBUILDER_PLACEHOLDERS_IMPORT" description="COM_COMPONENTBUILDER_PLACEHOLDERS_IMPORT_DESC" />
<action name="placeholder.submenu" title="COM_COMPONENTBUILDER_PLACEHOLDERS_SUBMENU" description="COM_COMPONENTBUILDER_PLACEHOLDERS_SUBMENU_DESC" />
<action name="power.init" title="COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS_DESC" />
<action name="power.reset" title="COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS_DESC" />
<action name="power.run_expansion" title="COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS_DESC" />
<action name="power.sync" title="COM_COMPONENTBUILDER_POWER_SYNC_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_SYNC_BUTTON_ACCESS_DESC" />
<action name="power.access" title="COM_COMPONENTBUILDER_POWERS_ACCESS" description="COM_COMPONENTBUILDER_POWERS_ACCESS_DESC" />
<action name="power.batch" title="COM_COMPONENTBUILDER_POWERS_BATCH_USE" description="COM_COMPONENTBUILDER_POWERS_BATCH_USE_DESC" />
<action name="power.create" title="COM_COMPONENTBUILDER_POWERS_CREATE" description="COM_COMPONENTBUILDER_POWERS_CREATE_DESC" />

View File

@ -17,8 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\Utilities\ArrayHelper;
###IMPORT_CONTROLLER_HEADER###
/**
* ###Component### Import Base Controller

View File

@ -17,8 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\Utilities\ArrayHelper;
###IMPORT_CUSTOM_CONTROLLER_HEADER###
/**
* ###Component### ###View### Base Controller

View File

@ -17,13 +17,9 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
use Joomla\Utilities\ArrayHelper;
use PhpOffice\PhpSpreadsheet\IOFactory;
###IMPORT_MODEL_HEADER###
/**
/***
* ###Component### Import Base Database Model
*/
class ###Component###ModelImport extends BaseDatabaseModel

View File

@ -17,11 +17,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
use Joomla\Utilities\ArrayHelper;
use PhpOffice\PhpSpreadsheet\IOFactory;
###IMPORT_CUSTOM_MODEL_HEADER###
/**
* ###Component### ###View### Base Database Model

View File

@ -0,0 +1 @@
###CHANGELOG###

View File

@ -207,6 +207,12 @@
"rename": false,
"type": "file"
},
"CHANGELOG.md": {
"naam": "CHANGELOG.md",
"path": "c0mp0n3nt/",
"rename": false,
"type": "file"
},
"headercheck.php": {
"naam": "headercheck.php",
"path": "c0mp0n3nt/site/helpers",

View File

@ -207,6 +207,12 @@
"rename": false,
"type": "file"
},
"CHANGELOG.md": {
"naam": "CHANGELOG.md",
"path": "c0mp0n3nt/",
"rename": false,
"type": "file"
},
"headercheck.php": {
"naam": "headercheck.php",
"path": "c0mp0n3nt/site/helpers",

View File

@ -679,6 +679,202 @@
default=""
/>
</fieldset>
<fieldset
name="super_power_custom_config"
label="COM_COMPONENTBUILDER_CONFIG_SUPER_POWER">
<!-- Note_not_ready_super_powers Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_not_ready_super_powers" label="COM_COMPONENTBUILDER_CONFIG_NOTE_NOT_READY_SUPER_POWERS_LABEL" heading="h2" class="alert alert-error note_not_ready_super_powers" />
<!-- Super_powers_documentation Field. Type: Radio. (joomla) -->
<field
type="radio"
name="super_powers_documentation"
label="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_DOCUMENTATION_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_DOCUMENTATION_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CONFIG_SHOW</option>
<option value="0">
COM_COMPONENTBUILDER_CONFIG_HIDE</option>
</field>
<!-- Note_super_powers Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_super_powers" label="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_DESCRIPTION" heading="h4" class="alert alert-info note_super_powers" showon="super_powers_documentation:1" />
<!-- Powers_repository Field. Type: Radio. (joomla) -->
<field
type="radio"
name="powers_repository"
label="COM_COMPONENTBUILDER_CONFIG_POWERS_REPOSITORY_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_POWERS_REPOSITORY_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CONFIG_YES</option>
<option value="0">
COM_COMPONENTBUILDER_CONFIG_NO</option>
</field>
<!-- Super_powers_repositories Field. Type: Radio. (joomla) -->
<field
type="radio"
name="super_powers_repositories"
label="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_REPOSITORIES_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_REPOSITORIES_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0"
required="true"
showon="powers_repository:1">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CONFIG_YES</option>
<option value="0">
COM_COMPONENTBUILDER_CONFIG_NO</option>
</field>
<!-- Note_super_powers_repositories Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_super_powers_repositories" label="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_REPOSITORIES_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_REPOSITORIES_DESCRIPTION" heading="h4" class="alert alert-info note_super_powers_repositories" showon="powers_repository:1[AND]super_powers_repositories:1" />
<!-- Approved_paths Field. Type: Subform. (joomla) -->
<field
type="subform"
name="approved_paths"
label="COM_COMPONENTBUILDER_CONFIG_APPROVED_PATHS_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
icon="list"
max="30"
min="1"
showon="powers_repository:1[AND]super_powers_repositories:1">
<form hidden="true" name="list_approved_paths_modal" repeat="true">
<!-- Owner Field. Type: Text. (joomla) -->
<field
type="text"
name="owner"
label="COM_COMPONENTBUILDER_CONFIG_OWNER_LABEL"
size="70"
maxlength="150"
class="text_area span12"
readonly="false"
filter="CMD"
hint="COM_COMPONENTBUILDER_CONFIG_OWNER_HINT"
autocomplete="on"
/>
<!-- Repo Field. Type: Text. (joomla) -->
<field
type="text"
name="repo"
label="COM_COMPONENTBUILDER_CONFIG_REPO_LABEL"
size="70"
maxlength="150"
class="text_area span12"
readonly="false"
filter="CMD"
hint="COM_COMPONENTBUILDER_CONFIG_REPO_HINT"
autocomplete="on"
/>
<!-- Branch Field. Type: Text. (joomla) -->
<field
type="text"
name="branch"
label="COM_COMPONENTBUILDER_CONFIG_BRANCH_LABEL"
size="70"
maxlength="150"
default="default"
class="text_area span12"
readonly="false"
filter="CMD"
hint="COM_COMPONENTBUILDER_CONFIG_BRANCH_HINT"
autocomplete="on"
/>
</form>
</field>
<!-- Note_powers_repository_path Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_powers_repository_path" label="COM_COMPONENTBUILDER_CONFIG_NOTE_POWERS_REPOSITORY_PATH_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_POWERS_REPOSITORY_PATH_DESCRIPTION" heading="h4" class="alert alert-info note_powers_repository_path" showon="powers_repository:1" />
<!-- Local_powers_repository_path Field. Type: Text. (joomla) -->
<field
type="text"
name="local_powers_repository_path"
label="COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_LABEL"
size="70"
maxlength="150"
description="COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="false"
filter="PATH"
message="COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_MESSAGE"
hint="COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_HINT"
autocomplete="on"
showon="powers_repository:1"
/>
<!-- Add_custom_gitea_url Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_custom_gitea_url"
label="COM_COMPONENTBUILDER_CONFIG_ADD_CUSTOM_GITEA_URL_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_ADD_CUSTOM_GITEA_URL_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CONFIG_GITVDMDEV</option>
<option value="2">
COM_COMPONENTBUILDER_CONFIG_CUSTOMGITEA</option>
</field>
<!-- Note_custom_gitea_url Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_custom_gitea_url" label="COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_GITEA_URL_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_GITEA_URL_DESCRIPTION" heading="h3" class="alert alert-success note_custom_gitea_url" showon="add_custom_gitea_url:2" />
<!-- Custom_gitea_url Field. Type: Url. (joomla) -->
<field
type="url"
name="custom_gitea_url"
label="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_LABEL"
size="70"
maxlength="150"
default="https://git.vdm.dev"
description="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_DESCRIPTION"
class="text_area"
filter="url"
validated="url"
scheme="http,https"
message="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_MESSAGE"
hint="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_HINT"
autocomplete="on"
showon="add_custom_gitea_url:2"
/>
<!-- Custom_gitea_token Field. Type: Password. (joomla) -->
<field
type="password"
name="custom_gitea_token"
label="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_LABEL"
size="128"
description="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_DESCRIPTION"
message="Error! Please add token here."
class="text_area"
readonly="false"
disabled="false"
required="false"
filter="STRING"
hint="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_HINT"
autocomplete="off"
showon="add_custom_gitea_url:2"
/>
<!-- Super_powers_core Field. Type: Text. (joomla) -->
<field
type="text"
name="super_powers_core"
label="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_LABEL"
size="70"
maxlength="150"
default="joomla/super-powers"
class="text_area"
filter="PATH"
hint="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_HINT"
autocomplete="on"
showon="add_custom_gitea_url:2"
/>
</fieldset>
<fieldset
name="compiler_custom_config"
label="COM_COMPONENTBUILDER_CONFIG_COMPILER">

View File

@ -14,6 +14,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
/**
* Componentbuilder Import_joomla_components Base Controller

View File

@ -14,6 +14,10 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
use VDM\Joomla\Utilities\ArrayHelper as JCBArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Language\Text;
/**
* Joomla_components Admin Controller
@ -198,12 +202,12 @@ class ComponentbuilderControllerJoomla_components extends AdminController
$session->set('backto_VDM_IMPORT', 'joomla_components');
$session->set('dataType_VDM_IMPORTINTO', 'smart_package');
// Redirect to import view.
$message = JText::_('COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LIKE_TO_IMPORTBR_SMALLPLEASE_NOTE_THAT_SMART_COMPONENT_IMPORT_ONLY_WORKS_WITH_THE_FOLLOWING_FORMAT_BZIPBSMALL');
$message = Text::_('COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LIKE_TO_IMPORTBR_SMALLPLEASE_NOTE_THAT_SMART_COMPONENT_IMPORT_ONLY_WORKS_WITH_THE_FOLLOWING_FORMAT_BZIPBSMALL');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components&target=smartPackage', false), $message);
return;
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP');
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
@ -211,7 +215,7 @@ class ComponentbuilderControllerJoomla_components extends AdminController
public function smartExport()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
JSession::checkToken() or die(Text::_('JINVALID_TOKEN'));
// Get the model
$model = $this->getModel('Joomla_components');
// check if export is allowed for this user.
@ -224,10 +228,10 @@ class ComponentbuilderControllerJoomla_components extends AdminController
// Sanitize the input
JArrayHelper::toInteger($pks);
// check if there is any selections
if (!ComponentbuilderHelper::checkArray($pks))
if (!JCBArrayHelper::check($pks))
{
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN');
$message = Text::_('COM_COMPONENTBUILDER_NO_COMPONENTS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
@ -237,43 +241,44 @@ class ComponentbuilderControllerJoomla_components extends AdminController
if ($model->getSmartExport($pks))
{
// set the key string
if (componentbuilderHelper::checkString($model->key) && strlen($model->key) == 32)
if (StringHelper::check($model->key) && strlen($model->key) == 32)
{
$keyNotice = '<h1>' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '</h1>';
$keyNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY') . '</h1>';
$keyNotice = '<h1>' . Text::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '</h1>';
$keyNotice .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_TWO_HUNDRED_AND_FIFTY_SIX_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY') . '</p>';
// set the package owner info
if (componentbuilderHelper::getPackageOwnerValue('owner', $model->info) || componentbuilderHelper::getPackageOwnerValue('company', $model->info))
if (PackageFactory::_('Display.Details')->hasOwner($model->info))
{
$ownerDetails = componentbuilderHelper::getPackageOwnerDetailsDisplay($model->info, true);
$ownerDetails = PackageFactory::_('Display.Details')->owner($model->info, true);
}
else
{
$ownerDetails = '<h2>' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '</h2>';
$ownerDetails .= '<p>' . JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE') . '</p>';
$ownerDetails .= '<h3>' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '</h3>';
$ownerDetails .= '<p>' . JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB') . '</p>';
$ownerDetails = '<h2>' . Text::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '</h2>';
$ownerDetails .= '<p>' . Text::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE') . '</p>';
$ownerDetails .= '<h3>' . Text::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '</h3>';
$ownerDetails .= '<p>' . Text::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB') . '</p>';
}
}
else
{
$keyNotice = '<h1>' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '</h1>';
$ownerDetails = '<p>' . JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB') . '</p>';
$keyNotice = '<h1>' . Text::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '</h1>';
$ownerDetails = '<p>' . Text::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB') . '</p>';
}
// Redirect to the list screen with success.
$message = array();
$message[] = '<h1>' . JText::_('COM_COMPONENTBUILDER_EXPORT_COMPLETED') . '</h1>';
$message[] = '<h1>' . Text::_('COM_COMPONENTBUILDER_EXPORT_COMPLETED') . '</h1>';
$message[] = '<p>' . JText::sprintf('COM_COMPONENTBUILDER_PATH_TO_THE_ZIPPED_PACKAGE_IS_CODESCODE_BR_S_S', $model->zipPath, $keyNotice, $ownerDetails) . '</p>';
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode('', $message), 'Success');
return;
}
else
{
if (componentbuilderHelper::checkString($model->packagePath))
if (StringHelper::check($model->packagePath))
{
// clear all if not successful
ComponentbuilderHelper::removeFolder($model->packagePath);
}
if (componentbuilderHelper::checkString($model->zipPath))
if (StringHelper::check($model->zipPath))
{
// clear all if not successful
JFile::delete($model->zipPath);
@ -281,7 +286,7 @@ class ComponentbuilderControllerJoomla_components extends AdminController
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED_PLEASE_TRY_AGAIN_LATTER');
$message = Text::_('COM_COMPONENTBUILDER_EXPORT_FAILED_PLEASE_TRY_AGAIN_LATTER');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
@ -318,8 +323,8 @@ class ComponentbuilderControllerJoomla_components extends AdminController
{
$textNotice = array();
$keyNotice = '<h1>' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '</h1>';
$keyNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_TWO_HUNDRED_AND_FIFTY_SIX_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY') . '</p>';
$textNotice[] = JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S', $model->key);
$keyNotice .= JText::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE') . '<br />';
// set the package owner info
if ((isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) || (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner'])))
{
@ -449,7 +454,7 @@ class ComponentbuilderControllerJoomla_components extends AdminController
public function cloner()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
JSession::checkToken() or die(Text::_('JINVALID_TOKEN'));
// Get the model
$model = $this->getModel('Joomla_components');
// check if export is allowed for this user.
@ -462,10 +467,10 @@ class ComponentbuilderControllerJoomla_components extends AdminController
// Sanitize the input
JArrayHelper::toInteger($pks);
// check if there is any selections
if (!ComponentbuilderHelper::checkArray($pks))
if (!JCBArrayHelper::check($pks))
{
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_NO_COMPONENT_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_OF_ONE_COMPONENT_AND_TRY_AGAIN');
$message = Text::_('COM_COMPONENTBUILDER_NO_COMPONENT_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_OF_ONE_COMPONENT_AND_TRY_AGAIN');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
@ -473,7 +478,7 @@ class ComponentbuilderControllerJoomla_components extends AdminController
elseif (count( (array) $pks) !== 1)
{
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_ONLY_ONE_COMPONENT_CAN_BE_CLONED_AT_A_TIME_PLEASE_SELECT_ONE_AND_TRY_AGAIN');
$message = Text::_('COM_COMPONENTBUILDER_ONLY_ONE_COMPONENT_CAN_BE_CLONED_AT_A_TIME_PLEASE_SELECT_ONE_AND_TRY_AGAIN');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
@ -483,17 +488,17 @@ class ComponentbuilderControllerJoomla_components extends AdminController
if ($model->cloner($pks))
{
// clone was successful
$message = JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_WITH_ALL_LINKED_ADMIN_VIEWS_FIELDS_LINKED_TO_ADMIN_VIEWS_CUSTOM_ADMIN_VIEWS_SITE_VIEWS_TEMPLATES_AND_LAYOUTS_WERE_CLONED_SUCCESSFUL');
$message = Text::_('COM_COMPONENTBUILDER_THE_COMPONENT_WITH_ALL_LINKED_ADMIN_VIEWS_FIELDS_LINKED_TO_ADMIN_VIEWS_CUSTOM_ADMIN_VIEWS_SITE_VIEWS_TEMPLATES_AND_LAYOUTS_WERE_CLONED_SUCCESSFUL');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message);
return;
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_CLONE_FAILED');
$message = Text::_('COM_COMPONENTBUILDER_CLONE_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_CLONE_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP');
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_CLONE_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
@ -502,5 +507,6 @@ class ComponentbuilderControllerJoomla_components extends AdminController
{
// admin area does not have API user, only front-end (so we fallback on login user)
return JFactory::getUser();
}
}
}

View File

@ -42,6 +42,94 @@ class ComponentbuilderControllerPower extends FormController
parent::__construct($config);
}
public function syncPowers()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// get IDS of the selected powers
$item = $this->input->post->get('jform', array(), 'array');
// check if there is any selections
if (empty($item['id']))
{
// set error message
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_NOT_SAVED').'</h1>';
$message .= '<p>'.JText::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE').'</p>';
// set redirect
$redirect_url = \JRoute::_(
'index.php?option=com_componentbuilder&view=power'
. $this->getRedirectToItemAppend(), false
);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
// check if user has the right
$user = JFactory::getUser();
if($user->authorise('power.sync', 'com_componentbuilder'))
{
// set success message
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_THIS_SYNC_FEATURE_IS_STILL_UNDER_DEVELOPMENT').'</h1>';
$message .= '<p>'.JText::sprintf('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_SOON_ANDOR_FOLLOW_THE_PROGRESS_ON_SGITVDMDEVA', '<a href="https://git.vdm.dev/joomla/Component-Builder/issues/984" target="_blank">').'</p>';
// set redirect
$redirect_url = \JRoute::_(
'index.php?option=com_componentbuilder&view=power'
. $this->getRedirectToItemAppend($item['id']), false
);
$this->setRedirect($redirect_url, $message);
return true;
}
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url);
return false;
}
public function resetPowers()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// get IDS of the selected powers
$item = $this->input->post->get('jform', array(), 'array');
// check if there is any selections
if (empty($item['id']))
{
// set error message
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_NOT_SAVED').'</h1>';
$message .= '<p>'.JText::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE').'</p>';
// set redirect
$redirect_url = \JRoute::_(
'index.php?option=com_componentbuilder&view=power'
. $this->getRedirectToItemAppend(), false
);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
// check if user has the right
$user = JFactory::getUser();
if($user->authorise('power.reset', 'com_componentbuilder'))
{
// set success message
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_THIS_RESET_FEATURE_IS_STILL_UNDER_DEVELOPMENT').'</h1>';
$message .= '<p>'.JText::sprintf('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_SOON_ANDOR_FOLLOW_THE_PROGRESS_ON_SGITVDMDEVA', '<a href="https://git.vdm.dev/joomla/Component-Builder/issues/984" target="_blank">').'</p>';
// set redirect
$redirect_url = \JRoute::_(
'index.php?option=com_componentbuilder&view=power'
. $this->getRedirectToItemAppend($item['id']), false
);
$this->setRedirect($redirect_url, $message);
return true;
}
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url);
return false;
}
/**
* Method override to check if you can add a new record.
*

View File

@ -83,5 +83,109 @@ class ComponentbuilderControllerPowers extends AdminController
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
public function initPowers()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if user has the right
$user = JFactory::getUser();
if($user->authorise('power.init', 'com_componentbuilder'))
{
// set success message
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_THIS_INIT_FEATURE_IS_STILL_UNDER_DEVELOPMENT').'</h1>';
$message .= '<p>'.JText::sprintf('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_SOON_ANDOR_FOLLOW_THE_PROGRESS_ON_SGITVDMDEVA', '<a href="https://git.vdm.dev/joomla/Component-Builder/issues/984" target="_blank">').'</p>';
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url, $message);
return true;
}
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url);
return false;
}
public function syncPowers()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// get IDS of the selected powers
$pks = $this->input->post->get('cid', [], 'array');
// Sanitize the input
JArrayHelper::toInteger($pks);
// check if there is any selections
if ($pks == [])
{
// set error message
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
$message .= '<p>'.JText::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
// check if user has the right
$user = JFactory::getUser();
if($user->authorise('power.sync', 'com_componentbuilder'))
{
// set success message
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_THIS_SYNC_FEATURE_IS_STILL_UNDER_DEVELOPMENT').'</h1>';
$message .= '<p>'.JText::sprintf('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_SOON_ANDOR_FOLLOW_THE_PROGRESS_ON_SGITVDMDEVA', '<a href="https://git.vdm.dev/joomla/Component-Builder/issues/984" target="_blank">').'</p>';
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url, $message);
return true;
}
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url);
return false;
}
public function resetPowers()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// get IDS of the selected powers
$pks = $this->input->post->get('cid', [], 'array');
// Sanitize the input
JArrayHelper::toInteger($pks);
// check if there is any selections
if ($pks == [])
{
// set error message
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
$message .= '<p>'.JText::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
// check if user has the right
$user = JFactory::getUser();
if($user->authorise('power.reset', 'com_componentbuilder'))
{
// set success message
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_THIS_RESET_FEATURE_IS_STILL_UNDER_DEVELOPMENT').'</h1>';
$message .= '<p>'.JText::sprintf('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_SOON_ANDOR_FOLLOW_THE_PROGRESS_ON_SGITVDMDEVA', '<a href="https://git.vdm.dev/joomla/Component-Builder/issues/984" target="_blank">').'</p>';
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url, $message);
return true;
}
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url);
return false;
}
}

View File

@ -603,6 +603,31 @@ class Compiler extends Infusion
}
}
}
// do super powers details if found
if (ArrayHelper::check(CFactory::_('Power')->superpowers))
{
foreach (CFactory::_('Power')->superpowers as $path => $powers)
{
$key = StringHelper::safe($path);
if (CFactory::_('Utilities.Files')->exists($key))
{
// update the power files
foreach (CFactory::_('Utilities.Files')->get($key) as $power_file)
{
if (File::exists($power_file['path']))
{
$this->setFileContent(
$power_file['name'], $power_file['path'],
$bom, $key
);
}
}
// free up some memory
CFactory::_('Utilities.Files')->remove($key);
CFactory::_('Content')->remove_($key);
}
}
}
return true;
}
@ -620,27 +645,33 @@ class Compiler extends Infusion
{
// for plugin event TODO change event api signatures
$component_context = CFactory::_('Config')->component_context;
// Trigger Event: jcb_ce_onBeforeSetFileContent
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeSetFileContent',
array(&$component_context, &$name, &$path, &$bom, &$view)
);
// set the file name
CFactory::_('Content')->set('FILENAME', $name);
// check if the file should get PHP opening
$php = '';
if (ComponentbuilderHelper::checkFileType($name, 'php'))
{
$php = "<?php\n";
}
// get content of the file
$string = FileHelper::getContent($path);
// Trigger Event: jcb_ce_onGetFileContents
CFactory::_('Event')->trigger(
'jcb_ce_onGetFileContents',
array(&$component_context, &$string, &$name, &$path, &$bom,
&$view)
);
// see if we should add a BOM
if (strpos((string) $string, (string) Placefix::_h('BOM')) !== false)
{
@ -649,8 +680,10 @@ class Compiler extends Infusion
);
$string = $php . $bom . $code;
}
// set the answer
$answer = CFactory::_('Placeholder')->update($string, CFactory::_('Content')->active, 3);
// set the dynamic answer
if ($view)
{
@ -658,19 +691,26 @@ class Compiler extends Infusion
$answer, CFactory::_('Content')->get_($view), 3
);
}
// check if this file needs extra care :)
if (isset($this->updateFileContent[$path]))
if (CFactory::_('Registry')->exists('update.file.content.' . $path))
{
$answer = CFactory::_('Customcode')->update($answer);
}
// Trigger Event: jcb_ce_onBeforeSetFileContent
CFactory::_('Event')->trigger(
'jcb_ce_onBeforeWriteFileContent',
array(&$component_context, &$answer, &$name, &$path, &$bom,
&$view)
);
// inject any super powers found
$answer = CFactory::_('Power.Injector')->power($answer);
// add answer back to file
CFactory::_('Utilities.File')->write($path, $answer);
// count the file lines
CFactory::_('Utilities.Counter')->line += substr_count((string) $answer, PHP_EOL);
}
@ -695,12 +735,20 @@ class Compiler extends Infusion
&& ($update_server = CFactory::_('Component')->get('update_server')) !== null)
{
// move to server
ComponentbuilderHelper::moveToServer(
if (!CFactory::_('Server')->legacyMove(
$update_server_xml_path,
$this->updateServerFileName . '.xml',
(int) $update_server,
CFactory::_('Component')->get('update_server_protocol')
);
))
{
$this->app->enqueueMessage(
JText::sprintf(
'Upload of component (%s) update server XML failed.',
CFactory::_('Component')->get('system_name')
), 'Error'
);
}
// remove the local file
File::delete($update_server_xml_path);
}
@ -726,12 +774,20 @@ class Compiler extends Infusion
))
{
// move to server
ComponentbuilderHelper::moveToServer(
if (!CFactory::_('Server')->legacyMove(
$module->update_server_xml_path,
$module->update_server_xml_file_name,
(int) $module->update_server,
$module->update_server_protocol
);
))
{
$this->app->enqueueMessage(
JText::sprintf(
'Upload of module (%s) update server XML failed.',
$module->name
), 'Error'
);
}
// remove the local file
File::delete($module->update_server_xml_path);
}
@ -759,12 +815,20 @@ class Compiler extends Infusion
))
{
// move to server
ComponentbuilderHelper::moveToServer(
if (!CFactory::_('Server')->legacyMove(
$plugin->update_server_xml_path,
$plugin->update_server_xml_file_name,
(int) $plugin->update_server,
$plugin->update_server_protocol
);
))
{
$this->app->enqueueMessage(
JText::sprintf(
'Upload of plugin (%s) update server XML failed.',
$plugin->name
), 'Error'
);
}
// remove the local file
File::delete($plugin->update_server_xml_path);
}
@ -832,6 +896,13 @@ class Compiler extends Infusion
{
// do a final run to update the readme file
$two = 0;
// counter data if not set already
if (!CFactory::_('Content')->exist('LINE_COUNT')
|| CFactory::_('Content')->get('LINE_COUNT') != CFactory::_('Utilities.Counter')->line)
{
CFactory::_('Utilities.Counter')->set();
}
// search for the readme
foreach (CFactory::_('Utilities.Files')->get('static') as $static)
{
if (('README.md' === $static['name']
@ -852,12 +923,6 @@ class Compiler extends Infusion
private function setReadMe($path)
{
// set readme data if not set already
if (!CFactory::_('Content')->exist('LINE_COUNT')
|| CFactory::_('Content')->get('LINE_COUNT') != CFactory::_('Utilities.Counter')->line)
{
CFactory::_('Utilities.Counter')->set();
}
// get the file
$string = FileHelper::getContent($path);
// update the file
@ -1051,12 +1116,20 @@ class Compiler extends Infusion
&$component_sales_name, &$this->componentData)
);
// move to server
ComponentbuilderHelper::moveToServer(
if (!CFactory::_('Server')->legacyMove(
$this->filepath['component'],
$component_sales_name . '.zip',
(int) CFactory::_('Component')->get('sales_server'),
CFactory::_('Component')->get('sales_server_protocol')
);
))
{
$this->app->enqueueMessage(
JText::sprintf(
'Upload of component (%s) zip file failed.',
CFactory::_('Component')->get('system_name')
), 'Error'
);
}
}
}
// Trigger Event: jcb_ce_onAfterZipComponent
@ -1146,12 +1219,20 @@ class Compiler extends Infusion
&$module)
);
// move to server
ComponentbuilderHelper::moveToServer(
if (!CFactory::_('Server')->legacyMove(
$this->filepath['modules'][$module->id],
$module->zip_name . '.zip',
(int) $module->sales_server,
$module->sales_server_protocol
);
))
{
$this->app->enqueueMessage(
JText::sprintf(
'Upload of module (%s) zip file failed.',
$module->name
), 'Error'
);
}
}
}
// Trigger Event: jcb_ce_onAfterZipModule
@ -1240,12 +1321,20 @@ class Compiler extends Infusion
&$plugin)
);
// move to server
ComponentbuilderHelper::moveToServer(
if (!CFactory::_('Server')->legacyMove(
$this->filepath['plugins'][$plugin->id],
$plugin->zip_name . '.zip',
(int) $plugin->sales_server,
$plugin->sales_server_protocol
);
))
{
$this->app->enqueueMessage(
JText::sprintf(
'Upload of plugin (%s) zip file failed.',
$plugin->name
), 'Error'
);
}
}
}
// Trigger Event: jcb_ce_onAfterZipPlugin
@ -1323,7 +1412,7 @@ class Compiler extends Infusion
if ($found && !$foundEnd)
{
$replace[] = (int) $lineBites[$lineNumber];
// we musk keep last three lines to dynamic find target entry
// we must keep last three lines to dynamic find target entry
$fingerPrint[$lineNumber] = trim($lineContent);
// check lines each time if it fits our target
if (count((array) $fingerPrint) === $sizeEnd
@ -1352,7 +1441,7 @@ class Compiler extends Infusion
{
$replace[] = (int) $lineBites[$lineNumber];
}
// we musk keep last three lines to dynamic find target entry
// we must keep last three lines to dynamic find target entry
$fingerPrint[$lineNumber] = trim($lineContent);
// check lines each time if it fits our target
if (count((array) $fingerPrint) === $size && !$found)
@ -1474,7 +1563,7 @@ class Compiler extends Infusion
$code = PHP_EOL . $commentType . implode(
$_commentType . PHP_EOL . $commentType, $code
) . $_commentType . PHP_EOL;
// get place holders
// get placeholders
$placeholder = CFactory::_('Placeholder')->keys(
(int) $target['comment_type'] . $target['type'], $target['id']
);
@ -1493,37 +1582,55 @@ class Compiler extends Infusion
$this->addDataToFile($file, $data, (int) array_sum($bitBucket));
}
// Thanks to http://stackoverflow.com/a/16813550/1429677
protected function addDataToFile($file, $data, $position, $replace = null)
/**
* Inserts or replaces data in a file at a specific position.
* Thanks to http://stackoverflow.com/a/16813550/1429677
*
* @param string $file The path of the file to modify
* @param string $data The data to insert or replace
* @param int $position The position in the file where the data should be inserted or replaced
* @param int|null $replace The number of bytes to replace; if null, data will be inserted
*
* @return void
* @throws RuntimeException if unable to open the file
*/
protected function addDataToFile(string $file, string $data, int $position, ?int $replace = null)
{
// start the process
$fpFile = fopen($file, "rw+");
$fpTemp = fopen('php://temp', "rw+");
// make a copy of the file
stream_copy_to_stream($fpFile, $fpTemp);
// move to the position where we should add the data
fseek($fpFile, $position);
// Add the data
fwrite($fpFile, (string) $data);
// truncate file at the end of the data that was added
$remove = MathHelper::bc(
'add', $position, mb_strlen((string) $data, '8bit')
);
ftruncate($fpFile, $remove);
// check if this was a replacement of data
if ($replace)
// Open the file and a temporary stream
$actual_file = fopen($file, "rw+");
if ($actual_file === false)
{
$position = MathHelper::bc(
'add', $position, $replace
);
throw new RuntimeException("Unable to open the file: {$file}");
}
// move to the position of the data that should remain below the new data
fseek($fpTemp, $position);
// copy that remaining data to the file
stream_copy_to_stream($fpTemp, $fpFile); // @Jack
// done close both files
fclose($fpFile);
fclose($fpTemp);
$temp_file = fopen('php://temp', "rw+");
// Make a copy of the file in the temporary stream
stream_copy_to_stream($actual_file, $temp_file);
// Move to the position where the data should be added
fseek($actual_file, $position);
// Add the data
fwrite($actual_file, $data);
// Truncate the file at the end of the added data if replacing
$data_length = mb_strlen($data, '8bit');
$remove = MathHelper::bc('add', $position, $data_length);
ftruncate($actual_file, $remove);
// check if this was a replacement of data
$position = MathHelper::bc('add', $position, $replace ?: 0);
// Move to the position of the remaining data in the temporary stream
fseek($temp_file, $position);
// Copy the remaining data from the temporary stream to the file
stream_copy_to_stream($temp_file, $actual_file);
// Close both file handles
fclose($actual_file);
fclose($temp_file);
// any help to improve this is welcome...
}

View File

@ -19,7 +19,6 @@ use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Unique;
/**
@ -1140,13 +1139,18 @@ class Get
// set the old version
CFactory::_('Component')->set('old_component_version', CFactory::_('Component')->component_version);
// set the new version, and set update switch
CFactory::_('Component')->set('component_version ', implode(
CFactory::_('Component')->set('component_version', implode(
'.', $version
));
}
// get powers *+*+*+*+*+*+*+*PRO
// load powers *+*+*+*+*+*+*+*
CFactory::_('Power')->load($this->linkedPowers);
// load any other super powers that was found
if (($super_powers = CFactory::_('Power.Extractor')->get_()) !== null)
{
CFactory::_('Power')->load($super_powers);
}
// set the percentage when a language can be added
$this->percentageLanguageAdd = (int) $this->params->get(
'percentagelanguageadd', 50
@ -2772,7 +2776,7 @@ class Get
* get the plugin xml template
*
* @return string
*
* @deprecated 3.3
*/
public function getPluginXMLTemplate(&$plugin)
{
@ -2804,7 +2808,6 @@ class Get
* @param int $when To set when to update
*
* @return void
*
* @deprecated 3.3
*/
protected function setNewCustomCode($when = 1)
@ -2826,7 +2829,6 @@ class Get
* @param int $when To set when to update
*
* @return void
*
* @deprecated 3.3
*/
protected function setExistingCustomCode($when = 1)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -116,7 +116,8 @@ class Infusion extends Interpretation
CFactory::_('Content')->get('CREATIONDATE'));
// BUILDDATE
CFactory::_('Content')->set('BUILDDATE', JFactory::getDate()->format('jS F, Y'));
CFactory::_('Content')->set('BUILDDATE', JFactory::getDate(
CFactory::_('Config')->get('build_date', 'now'))->format('jS F, Y'));
CFactory::_('Content')->set('GLOBALBUILDDATE',
CFactory::_('Content')->get('BUILDDATE'));
@ -624,8 +625,7 @@ class Infusion extends Interpretation
if (isset($view['port']) && $view['port']
|| 1 == $view['settings']->add_custom_import)
{
$this->eximportView[$nameListCode]
= true;
$this->eximportView[$nameListCode] = true;
if (1 == $view['settings']->add_custom_import)
{
// this view has custom import scripting
@ -1104,8 +1104,8 @@ class Infusion extends Interpretation
);
// check if this custom admin view is the default view
if ($this->dynamicDashboardType === 'custom_admin_views'
&& $this->dynamicDashboard === $view['settings']->code)
if (CFactory::_('Registry')->get('build.dashboard.type', '') === 'custom_admin_views'
&& CFactory::_('Registry')->get('build.dashboard', '') === $view['settings']->code)
{
// HIDEMAINMENU <<<DYNAMIC>>>
CFactory::_('Content')->set_($view['settings']->code, 'HIDEMAINMENU', '');
@ -1328,7 +1328,7 @@ class Infusion extends Interpretation
$this->setVersionController();
// only set these if default dashboard it used
if (!StringHelper::check($this->dynamicDashboard))
if (!CFactory::_('Registry')->get('build.dashboard'))
{
// DASHBOARDVIEW
CFactory::_('Content')->set('DASHBOARDVIEW', CFactory::_('Config')->component_code_name);
@ -1360,7 +1360,7 @@ class Infusion extends Interpretation
else
{
// DASHBOARDVIEW
CFactory::_('Content')->set('DASHBOARDVIEW', $this->dynamicDashboard);
CFactory::_('Content')->set('DASHBOARDVIEW', CFactory::_('Registry')->get('build.dashboard'));
}
// add import
@ -1368,7 +1368,7 @@ class Infusion extends Interpretation
{
// setup import files
$target = array('admin' => 'import');
$this->buildDynamique($target, 'import');
CFactory::_('Utilities.Structure')->build($target, 'import');
// IMPORT_EXT_METHOD <<<DYNAMIC>>>
CFactory::_('Content')->set_('import', 'IMPORT_EXT_METHOD', PHP_EOL . PHP_EOL . CFactory::_('Placeholder')->update_(
ComponentbuilderHelper::getDynamicScripts('ext')
@ -1381,6 +1381,14 @@ class Infusion extends Interpretation
CFactory::_('Content')->set_('import', 'IMPORT_SAVE_METHOD', PHP_EOL . PHP_EOL . CFactory::_('Placeholder')->update_(
ComponentbuilderHelper::getDynamicScripts('save')
));
// IMPORT_CONTROLLER_HEADER <<<DYNAMIC>>> add the header details for the controller
CFactory::_('Content')->set_('import', 'IMPORT_CONTROLLER_HEADER', $this->setFileHeader(
'import.controller', 'import'
));
// IMPORT_MODEL_HEADER <<<DYNAMIC>>> add the header details for the model
CFactory::_('Content')->set_('import', 'IMPORT_MODEL_HEADER', $this->setFileHeader(
'import.model', 'import'
));
}
// ensure that the ajax model and controller is set if needed
@ -1388,7 +1396,7 @@ class Infusion extends Interpretation
{
// setup Ajax files
$target = array('admin' => 'ajax');
$this->buildDynamique($target, 'ajax');
CFactory::_('Utilities.Structure')->build($target, 'ajax');
// set the controller
CFactory::_('Content')->set_('ajax', 'REGISTER_AJAX_TASK', $this->setRegisterAjaxTask('admin'));
CFactory::_('Content')->set_('ajax', 'AJAX_INPUT_RETURN', $this->setAjaxInputReturn('admin'));
@ -1403,7 +1411,7 @@ class Infusion extends Interpretation
{
// setup Ajax files
$target = array('site' => 'ajax');
$this->buildDynamique($target, 'ajax');
CFactory::_('Utilities.Structure')->build($target, 'ajax');
// set the controller
CFactory::_('Content')->set_('ajax', 'REGISTER_SITE_AJAX_TASK', $this->setRegisterAjaxTask('site'));
CFactory::_('Content')->set_('ajax', 'AJAX_SITE_INPUT_RETURN', $this->setAjaxInputReturn('site'));
@ -1420,7 +1428,7 @@ class Infusion extends Interpretation
{
// setup rule file
$target = array('admin' => 'a_rule_zi');
$this->buildDynamique($target, 'rule', $rule);
CFactory::_('Utilities.Structure')->build($target, 'rule', $rule);
// set the JFormRule Name
CFactory::_('Content')->set_('a_rule_zi_' . $rule, 'Name', ucfirst((string) $rule));
// set the JFormRule PHP
@ -1797,6 +1805,12 @@ class Infusion extends Interpretation
CFactory::_('Content')->set('README', CFactory::_('Component')->get('readme'));
}
// CHANGELOG
if (($changelog = CFactory::_('Component')->get('changelog')) !== null)
{
CFactory::_('Content')->set('CHANGELOG', $changelog);
}
// Infuse POWERS
CFactory::_('Power.Infusion')->set();

View File

@ -23,9 +23,9 @@ if (file_exists($composer_autoloader))
spl_autoload_register(function ($class) {
// project-specific base directories and namespace prefix
$search = [
'libraries/jcb_powers/VDM.Joomla.Gitea' => 'VDM\\Joomla\\Gitea',
'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla',
'libraries/jcb_powers/VDM.Minify' => 'VDM\\Minify',
'libraries/jcb_powers/VDM.Gitea' => 'VDM\\Gitea',
'libraries/jcb_powers/VDM.Psr' => 'VDM\\Psr'
];
// Start the search and load if found
@ -73,10 +73,10 @@ use Joomla\Utilities\ArrayHelper;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use VDM\Joomla\Utilities;
use Joomla\Archive\Archive;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Filesystem\Path;
use VDM\Joomla\Utilities;
/**
* Componentbuilder component helper.
@ -5523,571 +5523,6 @@ abstract class ComponentbuilderHelper
}
/**
* get extensions grouped list xml
**/
public static function getExtensionGroupedListXml()
{
// the extension types
$extensions = array(
'joomla_component' => 'COM_COMPONENTBUILDER_COMPONENT',
'joomla_module' => 'COM_COMPONENTBUILDER_MODULE',
'joomla_plugin' => 'COM_COMPONENTBUILDER_PLUGIN'
);
// get the extension values
foreach ($extensions as $extension => $label)
{
${$extension} = self::getByTypeTheIdsSystemNames($extension);
}
$xml = new DOMDocument();
$xml->formatOutput = true;
$root = $xml->createElement('field');
$root->setAttributeNode(new DOMAttr('name', 'extension'));
$root->setAttributeNode(new DOMAttr('type', 'groupedlist'));
$root->setAttributeNode(new DOMAttr('onchange', 'this.form.submit();'));
$root
->appendChild($xml->createElement('option', '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_EXTENSION') . ' -'))
->setAttributeNode(new DOMAttr('value', ''));
foreach ($extensions as $extension => $label)
{
$extension_node = $xml->createElement('group');
$extension_node->setAttributeNode(new DOMAttr('label', $label));
if (!self::checkArray(${$extension}))
{
$extension_node
->appendChild($xml->createElement('option', '- ' . JText::_('COM_COMPONENTBUILDER_NONE') . ' -'))
->setAttributeNode(new DOMAttr('disabled', 'true'));
}
else
{
foreach (${$extension} as $id => $element)
{
$extension_node
->appendChild($xml->createElement('option', $element))
->setAttributeNode(new DOMAttr('value', $extension . '__' . $id));
}
}
$root->appendChild($extension_node);
}
$xml->appendChild($root);
return $xml->saveXML();
}
/**
* get by type the ids and system names
**/
public static function getByTypeTheIdsSystemNames($type, $limiter = null)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select($db->quoteName(array('id', 'system_name')))
->from($db->quoteName('#__componentbuilder_' . $type))
->where($db->quoteName('published') . ' >= 1')
->order($db->quoteName('modified') . ' desc')
->order($db->quoteName('created') . ' desc');
// check if we have a limter for admin views
if ($type === 'admin_view' && $limiter)
{
// first get all views
$adminviewIds = array();
// if this is a plugin or a module, then no views
if (strpos($limiter, 'joomla_component') !== false)
{
$component = (int) str_replace('joomla_component__', '', $limiter);
// get the views of this component
if ($addViews = self::getVar('component_admin_views', (int) $component, 'joomla_component', 'addadmin_views'))
{
if (self::checkJson($addViews))
{
$addViews = json_decode($addViews, true);
if (self::checkArray($addViews))
{
foreach($addViews as $addView)
{
if (isset($addView['adminview']))
{
$adminviewIds[(int) $addView['adminview']] = (int) $addView['adminview'];
}
}
}
}
}
}
// now check if we still have admin views
if (self::checkArray($adminviewIds))
{
$query->where($db->quoteName('id') . ' IN (' . implode(',', $adminviewIds) . ')');
}
else
{
return false;
}
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadAssocList('id', 'system_name');
}
return false;
}
/**
* get any area linked IDs
*/
public static function getAreaLinkedIDs($extension, $type)
{
// What ever...
if ($type === 'joomla_component_admin_views')
{
return self::getComponentAdminViewsIDs($extension);
}
elseif ($type === 'joomla_component_custom_admin_views')
{
return self::getComponentCustomAdminViewsIDs($extension);
}
elseif ($type === 'joomla_component_site_views')
{
return self::getComponentSiteViewsIDs($extension);
}
elseif ($type === 'joomla_component')
{
return self::getComponentFieldsIDs($extension);
}
elseif ($type === 'joomla_module')
{
return self::getModuleFieldsIDs($extension);
}
elseif ($type === 'joomla_plugin')
{
return self::getPluginFieldsIDs($extension);
}
elseif ($type === 'admin_view')
{
return self::getAdminViewFieldsIDs($extension);
}
return false;
}
/**
* get a component admin views IDs
*/
public static function getComponentAdminViewsIDs($id)
{
// get all this components views
$adminviewIds = array();
// get the views of this component
if ($addViews = self::getVar('component_admin_views', (int) $id, 'joomla_component', 'addadmin_views'))
{
if (self::checkJson($addViews))
{
$addViews = json_decode($addViews, true);
if (self::checkArray($addViews))
{
foreach($addViews as $addView)
{
if (isset($addView['adminview']))
{
$adminviewIds[(int) $addView['adminview']] = (int) $addView['adminview'];
}
}
}
}
}
// check that we have fields
if (self::checkArray($adminviewIds))
{
return array_values($adminviewIds);
}
return false;
}
/**
* get a component custom admin views IDs
*/
public static function getComponentCustomAdminViewsIDs($id)
{
// get all this components views
$adminviewIds = array();
// get the views of this component
if ($addViews = self::getVar('component_custom_admin_views', (int) $id, 'joomla_component', 'addcustom_admin_views'))
{
if (self::checkJson($addViews))
{
$addViews = json_decode($addViews, true);
if (self::checkArray($addViews))
{
foreach($addViews as $addView)
{
if (isset($addView['customadminview']))
{
$adminviewIds[(int) $addView['customadminview']] = (int) $addView['customadminview'];
}
}
}
}
}
// check that we have fields
if (self::checkArray($adminviewIds))
{
return array_values($adminviewIds);
}
return false;
}
/**
* get a component site views IDs
*/
public static function getComponentSiteViewsIDs($id)
{
// get all this components views
$adminviewIds = array();
// get the views of this component
if ($addViews = self::getVar('component_site_views', (int) $id, 'joomla_component', 'addsite_views'))
{
if (self::checkJson($addViews))
{
$addViews = json_decode($addViews, true);
if (self::checkArray($addViews))
{
foreach($addViews as $addView)
{
if (isset($addView['siteview']))
{
$adminviewIds[(int) $addView['siteview']] = (int) $addView['siteview'];
}
}
}
}
}
// check that we have fields
if (self::checkArray($adminviewIds))
{
return array_values($adminviewIds);
}
return false;
}
/**
* get a component fields IDs
*/
public static function getComponentFieldsIDs($id)
{
// we start the field array
$fieldIds = array();
// first get all views
$adminviewIds = array();
// get the views of this component
if ($addViews = self::getVar('component_admin_views', (int) $id, 'joomla_component', 'addadmin_views'))
{
if (self::checkJson($addViews))
{
$addViews = json_decode($addViews, true);
if (self::checkArray($addViews))
{
foreach($addViews as $addView)
{
if (isset($addView['adminview']))
{
$adminviewIds[(int) $addView['adminview']] = (int) $addView['adminview'];
}
}
}
}
}
// check that we have views
if (self::checkArray($adminviewIds))
{
foreach ($adminviewIds as $adminView)
{
// get all the fields linked to the admin view
if ($addFields = self::getVar('admin_fields', (int) $adminView, 'admin_view', 'addfields'))
{
if (self::checkJson($addFields))
{
$addFields = json_decode($addFields, true);
if (self::checkArray($addFields))
{
foreach($addFields as $addField)
{
if (isset($addField['field']))
{
$fieldIds[(int) $addField['field']] = (int) $addField['field'];
}
}
}
}
}
}
}
// get config values
if ($addconfig = self::getVar('component_config', (int) $id, 'joomla_component', 'addconfig'))
{
if (self::checkJson($addconfig))
{
$addconfig = json_decode($addconfig, true);
if (self::checkArray($addconfig))
{
foreach($addconfig as $addconf)
{
if (isset($addconf['field']))
{
$fieldIds[(int) $addconf['field']] = (int) $addconf['field'];
}
}
}
}
}
// check that we have fields
if (self::checkArray($fieldIds))
{
return array_values($fieldIds);
}
return false;
}
/**
* get a module fields IDs
*/
public static function getModuleFieldsIDs($id)
{
// we start the field array
$fieldIds = array();
if ($fields = self::getVar('joomla_module', (int) $id, 'id', 'fields'))
{
if (self::checkJson($fields))
{
$fields = json_decode($fields, true);
if (self::checkArray($fields))
{
foreach($fields as $form)
{
if (isset($form['fields']) && self::checkArray($form['fields']))
{
foreach ($form['fields'] as $field)
{
if (isset($field['field']))
{
$fieldIds[(int) $field['field']] = (int) $field['field'];
}
}
}
}
}
}
}
// check that we have fields
if (self::checkArray($fieldIds))
{
return array_values($fieldIds);
}
return false;
}
/**
* get a plugin fields IDs
*/
public static function getPluginFieldsIDs($id)
{
// we start the field array
$fieldIds = array();
if ($fields = self::getVar('joomla_plugin', (int) $id, 'id', 'fields'))
{
if (self::checkJson($fields))
{
$fields = json_decode($fields, true);
if (self::checkArray($fields))
{
foreach($fields as $form)
{
if (isset($form['fields']) && self::checkArray($form['fields']))
{
foreach ($form['fields'] as $field)
{
if (isset($field['field']))
{
$fieldIds[(int) $field['field']] = (int) $field['field'];
}
}
}
}
}
}
}
// check that we have fields
if (self::checkArray($fieldIds))
{
return array_values($fieldIds);
}
return false;
}
/**
* get an admin view fields IDs
*/
public static function getAdminViewFieldsIDs($id)
{
// we start the field array
$fieldIds = array();
// get all the fields linked to the admin view
if ($addFields = self::getVar('admin_fields', (int) $id, 'admin_view', 'addfields'))
{
if (self::checkJson($addFields))
{
$addFields = json_decode($addFields, true);
if (self::checkArray($addFields))
{
foreach($addFields as $addField)
{
if (isset($addField['field']))
{
$fieldIds[(int) $addField['field']] = (int) $addField['field'];
}
}
}
}
}
// check that we have fields
if (self::checkArray($fieldIds))
{
return array_values($fieldIds);
}
return false;
}
/**
* get translation extension ids
**/
public static function getTranslationExtensionsIds($extension, $type)
{
// only allow these columns (extension types)
$columns = array(
'joomla_component' => 'components',
'joomla_module' => 'modules',
'joomla_plugin' => 'plugins'
);
// check if the column name is correct
if (isset($columns[$type]))
{
$column = $columns[$type];
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select($db->quoteName(array('id', $column)))
->from($db->quoteName('#__componentbuilder_language_translation'))
->where($db->quoteName($column) . ' != ' . $db->quote(''));
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$results = $db->loadAssocList();
$matches = array();
foreach ($results as $k => $v)
{
$value = json_decode($v[$column], true);
if (in_array($extension, $value))
{
$matches[$v['id']] = $v['id'];
}
}
// Checks that we found matches
if (self::checkArray($matches))
{
return array_values($matches);
}
}
}
return false;
}
/**
* get translation ids
**/
public static function getTranslationIds($language, $translated = true)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select($db->quoteName('id'))
->from($db->quoteName('#__componentbuilder_language_translation'));
// Build the where condition
if ($translated === true) // Translated
{
if ($language === 'all')
{
if (($languages = self::getAvailableLanguages()) !== false)
{
$wheres = array();
foreach ($languages as $k => $v)
{
$wheres[] = $db->quoteName('translation') . ' LIKE ' . $db->quote('%' . $k . '%');
}
$query->where($wheres);
}
}
else
{
$query->where($db->quoteName('translation') . ' LIKE ' . $db->quote('%' . $language . '%'));
}
}
else // Not translated
{
if ($language === 'none')
{
$query->where(
array(
$db->quoteName('translation') . ' = ' . $db->quote(''),
$db->quoteName('translation') . ' = ' . $db->quote('[]'),
$db->quoteName('translation') . ' = ' . $db->quote('{}')
), 'OR'
);
}
else
{
$query->where($db->quoteName('translation') . ' NOT LIKE ' . $db->quote('%' . $language . '%'));
}
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return array_unique($db->loadColumn());
}
return false;
}
/**
* get available languages
**/
public static function getAvailableLanguages()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select($db->quoteName(array('langtag', 'name')))
->from($db->quoteName('#__componentbuilder_language'))
->where($db->quoteName('published') . ' = 1')
->order($db->quoteName('name') . ' desc');
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadAssocList('langtag', 'name');
}
return false;
}
/**
* Check if a row already exist
*

File diff suppressed because one or more lines are too long

View File

@ -1012,8 +1012,14 @@ COM_COMPONENTBUILDER_POWERS_EDIT_VERSION="Powers Edit Version"
COM_COMPONENTBUILDER_POWERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version powers"
COM_COMPONENTBUILDER_POWERS_SUBMENU="Powers Submenu"
COM_COMPONENTBUILDER_POWERS_SUBMENU_DESC="Allows the users in this group to submenu of power"
COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS="Power Init Button Access"
COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS="Power Reset Button Access"
COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS="Power Run Expansion Button Access"
COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button."
COM_COMPONENTBUILDER_POWER_SYNC_BUTTON_ACCESS="Power Sync Button Access"
COM_COMPONENTBUILDER_POWER_SYNC_BUTTON_ACCESS_DESC="Allows the users in this group to access the sync button."
COM_COMPONENTBUILDER_SEARCH_ACCESS="Search Access"
COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC="Allows the users in this group to access search."
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS="Search Compiler Button Access"

View File

@ -0,0 +1,116 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @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
*/
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
// Different support requests/appreciation
$support = [
JText::_("COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_JCB_IS_A_CRUCIAL_TOOL_FOR_PHP_PROGRAMMERS_WHO_USE_JOOMLA_TO_EARN_A_LIVING_BY_MAKING_A_BFINANCIAL_DONATIONB_YOU_CAN_SUPPORT_THE_GROWTH_AND_CONTINUITY_OF_THIS_VITAL_RESOURCE_AND_ENSURE_ITS_RELEVANCE_FOR_YEARS_TO_COME_YOUR_CONTRIBUTION_NO_MATTER_HOW_BIG_OR_SMALL_WILL_BE_DEEPLY_APPRECIATED_BY_THE_PROJECTS_TEAM_AND_THE_WIDER_COMMUNITY"),
JText::_("COM_COMPONENTBUILDER_THE_CONTINUED_SUPPORT_OF_INDIVIDUALS_LIKE_YOU_HAS_ALLOWED_JOOMLA_COMPONENT_BUILDER_JCB_TO_THRIVE_FOR_SEVEN_YEARS_SINCE_GOING_PUBLIC_YOUR_CONTRIBUTIONS_HAVE_BEEN_CRUCIAL_IN_ENSURING_THE_GROWTH_AND_RELEVANCE_OF_THIS_VITAL_TOOL_FOR_PHP_PROGRAMMERS_THANK_YOU_FOR_YOUR_SUPPORT_AND_FOR_BEING_A_PART_OF_JCBS_JOURNEY"),
JText::_("COM_COMPONENTBUILDER_SUPPORT_JOOMLA_COMPONENT_BUILDER_JCB_WITH_A_BFINANCIAL_DONATIONB_TO_SHOW_GRATITUDE_FOR_THE_TIME_AND_EFFORT_SAVED_IN_YOUR_DEVELOPMENT_PROCESS_YOUR_CONTRIBUTION_NO_MATTER_THE_SIZE_WILL_BE_APPRECIATED_BY_THE_PROJECTS_TEAM_AND_THE_WIDER_COMMUNITY_HELP_ENSURE_THE_GROWTH_AND_RELEVANCE_OF_THIS_ESSENTIAL_TOOL"),
JText::_("COM_COMPONENTBUILDER_INVEST_IN_THE_FUTURE_OF_JOOMLA_COMPONENT_BUILDER_JCB_BY_MAKING_A_BFINANCIAL_DONATIONB_SUPPORT_THE_NECESSARY_DEVELOPMENT_AND_MAINTENANCE_OF_THIS_OPENSOURCE_PROJECT_ENSURING_ITS_CONTINUED_GROWTH_AND_RELEVANCE_FOR_THE_COMMUNITY_YOUR_CONTRIBUTION_WILL_HELP_SECURE_THE_FUTURE_OF_THIS_VITAL_TOOL_FOR_PHP_PROGRAMMERS"),
JText::_("COM_COMPONENTBUILDER_INVEST_IN_THE_FUTURE_OF_JOOMLA_COMPONENT_BUILDER_JCB_BY_MAKING_A_BFINANCIAL_CONTRIBUTIONB_NO_MATTER_HOW_SMALL_THE_CONTINUAL_SUPPORT_OF_ALL_THOSE_USING_THE_TOOL_WILL_BE_MORE_THAN_ENOUGH_TO_ENSURE_ITS_CONTINUED_GROWTH_AND_RELEVANCE_BY_INVESTING_IN_THIS_OPENSOURCE_PROJECT_YOU_ARE_SECURING_ITS_FUTURE_AS_A_VITAL_TOOL_FOR_PHP_PROGRAMMERS"),
JText::_("COM_COMPONENTBUILDER_WE_EXTEND_OUR_GRATITUDE_TO_ALL_THOSE_WHO_SUPPORT_JOOMLA_COMPONENT_BUILDER_JCB_WHETHER_AS_A_HOBBY_OR_AS_A_PART_OF_THEIR_BUSINESS_YOUR_CONTRIBUTIONS_WHETHER_FINANCIAL_OR_IN_THE_FORM_OF_ACTIVE_INVOLVEMENT_HAVE_HAD_A_SIGNIFICANT_IMPACT_ON_ENSURING_THE_GROWTH_AND_RELEVANCE_OF_THIS_VITAL_TOOL_FOR_PHP_PROGRAMMERS_WE_HIGHLY_VALUE_THE_DEDICATION_OF_HOBBYISTS_AND_THE_COMMITMENT_OF_COMPANIES_WHO_SUPPORT_JCB_AS_THEY_HAVE_ALLOWED_THE_PROJECT_TO_CONTINUE_ITS_DEVELOPMENT_AND_MAINTENANCE_PROVIDING_VALUABLE_RESOURCES_FOR_THE_COMMUNITY_WE_ARE_GRATEFUL_FOR_YOUR_CONTRIBUTIONS_NO_MATTER_HOW_SMALL_AND_THANK_YOU_FOR_BEING_A_PART_OF_THE_POSITIVE_IMPACT_THAT_JCB_HAS_ON_THE_PHP_PROGRAMMING_COMMUNITY"),
JText::_("COM_COMPONENTBUILDER_WITHOUT_SUFFICIENT_SUPPORT_THE_FUTURE_OF_JOOMLA_COMPONENT_BUILDER_JCB_IS_IN_JEOPARDY_AS_A_VITAL_TOOL_FOR_PHP_PROGRAMMERS_IT_IS_CRUCIAL_TO_ENSURE_ITS_CONTINUED_DEVELOPMENT_AND_MAINTENANCE_BY_MAKING_A_BFINANCIAL_CONTRIBUTIONB_NO_MATTER_HOW_SMALL_YOU_ARE_HELPING_TO_SAFEGUARD_THE_FUTURE_OF_THIS_OPENSOURCE_PROJECT_NEGLECTING_TO_SUPPORT_JCB_COULD_RESULT_IN_ITS_DECLINE_AND_LOSS_AS_A_RESOURCE_FOR_THE_COMMUNITY"),
JText::_("COM_COMPONENTBUILDER_WE_EXTEND_OUR_HEARTFELT_APPRECIATION_TO_THOSE_WHO_HAVE_SUPPORTED_THE_JOOMLA_COMPONENT_BUILDER_JCB_PROJECT_OVER_THE_YEARS_YOUR_CONTRIBUTIONS_NO_MATTER_HOW_BIG_OR_SMALL_HAVE_BEEN_INSTRUMENTAL_IN_ENSURING_ITS_GROWTH_AND_RELEVANCE_AS_A_VITAL_TOOL_FOR_PHP_PROGRAMMERS_SEVEN_YEARS_AFTER_GOING_PUBLIC_JCB_IS_STILL_HERE_TODAY_BECAUSE_OF_THE_SUPPORT_OF_INDIVIDUALS_LIKE_YOU_WHO_BELIEVE_IN_THE_IMPORTANCE_OF_THIS_OPENSOURCE_PROJECT_YOUR_GENEROSITY_HAS_ALLOWED_THE_PROJECT_TO_CONTINUE_ITS_DEVELOPMENT_AND_MAINTENANCE_PROVIDING_VALUABLE_RESOURCES_FOR_THE_COMMUNITY_THANK_YOU_FOR_YOUR_UNWAVERING_SUPPORT_AND_FOR_BEING_A_PART_OF_JCBS_JOURNEY"),
JText::_("COM_COMPONENTBUILDER_WE_EXTEND_OUR_SINCERE_APPRECIATION_TO_THE_COMPANIES_WHO_USE_JOOMLA_COMPONENT_BUILDER_JCB_AND_SUPPORT_THE_PROJECT_YOUR_CONTRIBUTIONS_WHETHER_FINANCIAL_OR_IN_THE_FORM_OF_ACTIVE_INVOLVEMENT_HAVE_BEEN_INSTRUMENTAL_IN_ENSURING_THE_GROWTH_AND_RELEVANCE_OF_THIS_VITAL_TOOL_FOR_PHP_PROGRAMMERS_YOUR_SUPPORT_HAS_ALLOWED_JCB_TO_CONTINUE_ITS_DEVELOPMENT_AND_MAINTENANCE_PROVIDING_VALUABLE_RESOURCES_FOR_THE_COMMUNITY_THANK_YOU_FOR_YOUR_UNWAVERING_COMMITMENT_TO_THE_PROJECT_AND_FOR_BEING_A_PART_OF_JCBS_JOURNEY")
];
// build the support message
$support_message = $support[random_int(0, 8)];
// the button titles
$titles = [
JText::_("COM_COMPONENTBUILDER_JCB_ENABLES_PHP_DEVELOPMENT"),
JText::_("COM_COMPONENTBUILDER_JCB_SUPPORTS_OPENSOURCE"),
JText::_("COM_COMPONENTBUILDER_JCB_SAVES_TIME"),
JText::_("COM_COMPONENTBUILDER_JCB_IMPROVES_WORKFLOW"),
JText::_("COM_COMPONENTBUILDER_JCB_EMPOWERS_PHP_DEVELOPERS"),
JText::_("COM_COMPONENTBUILDER_JCB_STREAMLINES_DEVELOPMENT"),
JText::_("COM_COMPONENTBUILDER_JCB_PROMOTES_EFFICIENCY"),
JText::_("COM_COMPONENTBUILDER_JCB_ENHANCES_PRODUCTIVITY"),
JText::_("COM_COMPONENTBUILDER_JCB_INCREASES_REVENUE"),
JText::_("COM_COMPONENTBUILDER_JCB_REDUCES_DEVELOPMENT_COSTS"),
JText::_("COM_COMPONENTBUILDER_JCB_SUPPORTS_THE_PHP_COMMUNITY"),
JText::_("COM_COMPONENTBUILDER_JCB_IMPROVES_PHP_DEVELOPMENT"),
JText::_("COM_COMPONENTBUILDER_JCB_HELPS_GROW_BUSINESSES"),
JText::_("COM_COMPONENTBUILDER_JCB_SUPPORTS_PHP_INNOVATION"),
JText::_("COM_COMPONENTBUILDER_JCB_CONTRIBUTES_TO_OPENSOURCE"),
JText::_("COM_COMPONENTBUILDER_JCB_PROVIDES_A_BETTER_EXPERIENCE"),
JText::_("COM_COMPONENTBUILDER_JCB_OFFERS_MORE_FEATURES"),
JText::_("COM_COMPONENTBUILDER_JCB_INCREASES_DEVELOPMENT_SPEED"),
JText::_("COM_COMPONENTBUILDER_JCB_IMPROVES_USER_EXPERIENCE"),
JText::_("COM_COMPONENTBUILDER_JCB_INCREASES_USER_SATISFACTION"),
JText::_("COM_COMPONENTBUILDER_JCB_LOWERS_DEVELOPMENT_STRESS"),
JText::_("COM_COMPONENTBUILDER_JCB_PROMOTES_GOODWILL"),
JText::_("COM_COMPONENTBUILDER_JCB_OFFERS_A_STRONGER_SOLUTION"),
JText::_("COM_COMPONENTBUILDER_JCB_SUPPORTS_A_WORTHY_CAUSE"),
JText::_("COM_COMPONENTBUILDER_JCB_BUILDS_A_BETTER_FUTURE"),
JText::_("COM_COMPONENTBUILDER_JCB_FOSTERS_A_STRONG_COMMUNITY"),
JText::_("COM_COMPONENTBUILDER_JCB_IMPROVES_PHPS_REPUTATION"),
JText::_("COM_COMPONENTBUILDER_JCB_SUPPORTS_A_THRIVING_ECOSYSTEM"),
JText::_("COM_COMPONENTBUILDER_JCB_HELPS_PHP_THRIVE"),
JText::_("COM_COMPONENTBUILDER_JCB_INVESTS_IN_PHPS_SUCCESS")
];
// build the support button
$support_titles = $titles[random_int(0, 29)];
// the button names
$button_names = [
JText::_("COM_COMPONENTBUILDER_DONATE_TO_JCB"),
JText::_("COM_COMPONENTBUILDER_SUPPORT_JCB_TODAY"),
JText::_("COM_COMPONENTBUILDER_CONTRIBUTE_TO_JCB"),
JText::_("COM_COMPONENTBUILDER_INVEST_IN_JCB"),
JText::_("COM_COMPONENTBUILDER_GIVE_TO_JCB"),
JText::_("COM_COMPONENTBUILDER_JOIN_JCBS_MISSION"),
JText::_("COM_COMPONENTBUILDER_HELP_JCB_GROW"),
JText::_("COM_COMPONENTBUILDER_BE_A_PART_OF_JCB"),
JText::_("COM_COMPONENTBUILDER_JCB_NEEDS_YOU"),
JText::_("COM_COMPONENTBUILDER_BECOME_A_CONTRIBUTOR"),
JText::_("COM_COMPONENTBUILDER_EMPOWER_JCB"),
JText::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_IMPACT"),
JText::_("COM_COMPONENTBUILDER_JOIN_JCBS_COMMUNITY"),
JText::_("COM_COMPONENTBUILDER_MAKE_A_DIFFERENCE_WITH_JCB"),
JText::_("COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_MATTERS"),
JText::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_THE_FUTURE"),
JText::_("COM_COMPONENTBUILDER_JOIN_JCBS_JOURNEY"),
JText::_("COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_COUNTS"),
JText::_("COM_COMPONENTBUILDER_EMPOWER_THE_FUTURE_WITH_JCB"),
JText::_("COM_COMPONENTBUILDER_JCB_YOUR_CONTRIBUTION_MATTERS"),
JText::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_PROGRESS"),
JText::_("COM_COMPONENTBUILDER_JOIN_JCBS_VISION"),
JText::_("COM_COMPONENTBUILDER_ELEVATE_JCB_TODAY"),
JText::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_CHANGE"),
JText::_("COM_COMPONENTBUILDER_JCB_YOUR_DONATION_MATTERS"),
JText::_("COM_COMPONENTBUILDER_JCB_BE_THE_CHANGE"),
JText::_("COM_COMPONENTBUILDER_JOIN_JCBS_SUCCESS"),
JText::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_SUCCESS"),
JText::_("COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_IS_KEY"),
JText::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_THE_COMMUNITY"),
JText::_("COM_COMPONENTBUILDER_JCB_YOUR_SUPPORT_MATTERS_MOST"),
JText::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_YOUR_FUTURE"),
JText::_("COM_COMPONENTBUILDER_JCB_INVEST_IN_PROGRESS_TODAY")
];
// build the support button
$support_button = $button_names[random_int(0, 32)];
?>
<?php echo $support_message; ?>
<br /><br />
<img src="https://opencollective.com/joomla-component-builder/tiers/badge.svg" />
<br /><br />
<a class="btn btn-mini btn-success" href="https://opencollective.com/joomla-component-builder/donate?interval=month&amount=20" title="<?php echo $support_titles; ?>" trage="_blank">
<?php echo $support_button; ?>
</a>
<br />

View File

@ -0,0 +1,43 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'approved',
'approved_paths'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -0,0 +1,42 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'note_approved_paths'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -14,6 +14,8 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
/**
* Admin_views List Model
@ -70,7 +72,7 @@ class ComponentbuilderModelAdmin_views extends ListModel
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -'
);
// check if we have joomla components
if (($joomla_components = ComponentbuilderHelper::getByTypeTheIdsSystemNames('joomla_component')) !== false)
if (($joomla_components = JCBFilterHelper::names('joomla_component')) !== null)
{
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -'
@ -79,7 +81,7 @@ class ComponentbuilderModelAdmin_views extends ListModel
$options = $options + $joomla_components;
}
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
$form->setValue(
'joomla_component',
'filter',
@ -88,7 +90,8 @@ class ComponentbuilderModelAdmin_views extends ListModel
array_push($this->filter_fields, 'joomla_component');
return $form;
}
}
/**
* Method to auto-populate the model state.
@ -354,7 +357,7 @@ class ComponentbuilderModelAdmin_views extends ListModel
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_admin_views')) !== false)
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_admin_views')) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
@ -589,7 +592,7 @@ class ComponentbuilderModelAdmin_views extends ListModel
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_admin_views')) !== false)
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_admin_views')) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}

View File

@ -14,8 +14,13 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Gitea\Factory as GiteaFactory;
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\Registry\Registry;
use VDM\Gitea\Gitea;
use Joomla\CMS\Language\Text;
use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
/**
@ -90,7 +95,7 @@ class ComponentbuilderModelAjax extends ListModel
// set the url
$url = "https://api.crowdin.com/api/project/$identifier/info?key=$key&json";
// get the details
if (($details = ComponentbuilderHelper::getFileContents($url, false)) !== false && ComponentbuilderHelper::checkJson($details))
if (($details = FileHelper::getContent($url, false)) !== false && JsonHelper::check($details))
{
$details = json_decode($details, true);
// check if there is an error
@ -102,9 +107,9 @@ class ComponentbuilderModelAjax extends ListModel
if (isset($details['details']))
{
$html = '<div class="alert alert-success" id="crowdin_message">';
$html .= '<h1>' . JText::_('COM_COMPONENTBUILDER_COMPONENT_SUCCESSFULLY_LINKED') . '</h1>';
$html .= '<h1>' . Text::_('COM_COMPONENTBUILDER_COMPONENT_SUCCESSFULLY_LINKED') . '</h1>';
$html .= '<h3>' . $details['details']['name'] . '</h3>';
if (ComponentbuilderHelper::checkString($details['details']['description']))
if (StringHelper::check($details['details']['description']))
{
$html .= '<p>';
$html .= $details['details']['description'];
@ -128,7 +133,7 @@ class ComponentbuilderModelAjax extends ListModel
$html .= '</b></li>';
$html .= '</ul>';
$html .= '</div>';
return array('html' => $html);
return ['html' => $html];
}
}
return false;
@ -153,7 +158,7 @@ class ComponentbuilderModelAjax extends ListModel
$db->execute();
if ($db->loadRowList())
{
return array( 'html' => $this->componentDetailsDisplay($db->loadObject()));
return ['html' => $this->componentDetailsDisplay($db->loadObject())];
}
return false;
}
@ -166,47 +171,33 @@ class ComponentbuilderModelAjax extends ListModel
// convert URL
$url = base64_decode($package);
$url = str_replace('.zip', '.info', $url);
// check if url exist
if ($info = ComponentbuilderHelper::getFileContents($url, false))
if ($info = FileHelper::getContent($url, false))
{
// Get the encryption object.
$db = 'COM_COMPONENTBUILDER_VJRZDESSMHBTRWFIFTYTWVZEROAESFLVVXJTMTHREEJTWOIXM';
$password = base64_decode(JText::sprintf($db, 'QzdmV', '9kQ'));
// we first use the new encryption
// load phpseclib <https://phpseclib.com/docs/symmetric>
$opened = false;
if(ComponentbuilderHelper::crypt('AES', 'CBC') instanceof \phpseclib\Crypt\Rijndael)
{
// load the system password
ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($password, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt');
// open the info block
$_info = ComponentbuilderHelper::crypt('AES', 'CBC')->decrypt(base64_decode($info));
// check if we had success
if ($_info !== false)
{
$opened = true;
}
}
$_info = PackageFactory::_('Crypt')->decrypt($info, 'local.legacy');
// check if we had success
if (!$opened && class_exists('FOFEncryptAes'))
if (!JsonHelper::check($_info))
{
$opener = new FOFEncryptAes($password, 128);
$_info = $opener->decryptString($info);
// check if we had success
if ($_info !== false)
{
$opened = true;
$_info = rtrim($_info, "\0");
}
$_info = PackageFactory::_('Crypt')->decrypt($info, 'local.fof');
}
// check if we have json
if ($opened && ComponentbuilderHelper::checkJson($_info))
if (JsonHelper::check($_info))
{
$info = json_decode($_info, true);
return array('owner' => ComponentbuilderHelper::getPackageOwnerDetailsDisplay($info, true), 'packages' => ComponentbuilderHelper::getPackageComponentsDetailsDisplay($info));
return [
'owner' => PackageFactory::_('Display.Details')->owner($info, true),
'packages' => PackageFactory::_('Display.Details')->components($info)
];
}
}
return array('error' => JText::_('COM_COMPONENTBUILDER_JCB_PACKAGE_INFO_PATH_DOES_NOT_WORK_WE_ADVICE_YOU_BNOT_TO_CONTINUEB_WITH_THE_IMPORT_OF_THE_SELECTED_PACKAGE'));
return [
'error' => Text::_('COM_COMPONENTBUILDER_JCB_PACKAGE_INFO_PATH_DOES_NOT_WORK_WE_ADVICE_YOU_BNOT_TO_CONTINUEB_WITH_THE_IMPORT_OF_THE_SELECTED_PACKAGE')
];
}
/**
@ -215,29 +206,29 @@ class ComponentbuilderModelAjax extends ListModel
protected function componentDetailsDisplay($object)
{
// set some vars
$image = (ComponentbuilderHelper::checkString($object->image)) ? '<img alt="Joomla Component Image" src="'. JURI::root() . $object->image . '" style="float: right;">': '';
$desc = (ComponentbuilderHelper::checkString($object->description)) ? $object->description : $object->short_description;
$placeholder = ($object->add_placeholders == 1) ? '<span class="btn btn-small btn-success"> ' . JText::_('COM_COMPONENTBUILDER_YES') . ' </span>' : '<span class="btn btn-small btn-danger"> ' .JText::_('COM_COMPONENTBUILDER_NO') . ' </span>' ;
$debug = ($object->debug_linenr == 1) ? '<span class="btn btn-small btn-success"> ' .JText::_('COM_COMPONENTBUILDER_YES') . '</span>' : ' <span class="btn btn-small btn-danger"> ' .JText::_('COM_COMPONENTBUILDER_NO') . ' </span>' ;
$image = (StringHelper::check($object->image)) ? '<img alt="Joomla Component Image" src="'. JURI::root() . $object->image . '" style="float: right;">': '';
$desc = (StringHelper::check($object->description)) ? $object->description : $object->short_description;
$placeholder = ($object->add_placeholders == 1) ? '<span class="btn btn-small btn-success"> ' . Text::_('COM_COMPONENTBUILDER_YES') . ' </span>' : '<span class="btn btn-small btn-danger"> ' .Text::_('COM_COMPONENTBUILDER_NO') . ' </span>' ;
$debug = ($object->debug_linenr == 1) ? '<span class="btn btn-small btn-success"> ' .Text::_('COM_COMPONENTBUILDER_YES') . '</span>' : ' <span class="btn btn-small btn-danger"> ' .Text::_('COM_COMPONENTBUILDER_NO') . ' </span>' ;
$html = array();
$html[] = '<h3>' . $object->name . ' (v' . $object->component_version . ')</h3>';
$html[] = '<p>' . $desc . $image . '</p>';
$html[] = '<ul>';
$html[] = '<li>' . JText::_('COM_COMPONENTBUILDER_COMPANY') . ': <b>' . $object->companyname . '</b></li>';
$html[] = '<li>' . JText::_('COM_COMPONENTBUILDER_AUTHOR') . ': <b>' . $object->author . '</b></li>';
$html[] = '<li>' . JText::_('COM_COMPONENTBUILDER_EMAIL') . ': <b>' . $object->email . '</b></li>';
$html[] = '<li>' . JText::_('COM_COMPONENTBUILDER_WEBSITE') . ': <b>' . $object->website . '</b></li>';
$html[] = '<li>' . Text::_('COM_COMPONENTBUILDER_COMPANY') . ': <b>' . $object->companyname . '</b></li>';
$html[] = '<li>' . Text::_('COM_COMPONENTBUILDER_AUTHOR') . ': <b>' . $object->author . '</b></li>';
$html[] = '<li>' . Text::_('COM_COMPONENTBUILDER_EMAIL') . ': <b>' . $object->email . '</b></li>';
$html[] = '<li>' . Text::_('COM_COMPONENTBUILDER_WEBSITE') . ': <b>' . $object->website . '</b></li>';
$html[] = '</ul>';
$html[] = '<h4>' . JText::_('COM_COMPONENTBUILDER_COMPONENT_GLOBAL_SETTINGS') . '</h4>';
$html[] = '<h4>' . Text::_('COM_COMPONENTBUILDER_COMPONENT_GLOBAL_SETTINGS') . '</h4>';
$html[] = '<p>';
$html[] = JText::_('COM_COMPONENTBUILDER_ADD_CUSTOM_CODE_PLACEHOLDERS') . '<br />' . $placeholder . '<br />';
$html[] = JText::_('COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS') . '<br />' . $debug ;
$html[] = Text::_('COM_COMPONENTBUILDER_ADD_CUSTOM_CODE_PLACEHOLDERS') . '<br />' . $placeholder . '<br />';
$html[] = Text::_('COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS') . '<br />' . $debug ;
$html[] = '</p>';
$html[] = '<h4>' . JText::_('COM_COMPONENTBUILDER_LICENSE') . '</h4>';
$html[] = '<h4>' . Text::_('COM_COMPONENTBUILDER_LICENSE') . '</h4>';
$html[] = '<p>' . $object->license . '</p>';
$html[] = '<h4>' . JText::_('COM_COMPONENTBUILDER_COPYRIGHT') . '</h4>';
$html[] = '<h4>' . Text::_('COM_COMPONENTBUILDER_COPYRIGHT') . '</h4>';
$html[] = '<p>' . $object->copyright . '<br /><br />';
$html[] = '<a href="index.php?option=com_componentbuilder&ref=compiler&view=joomla_components&task=joomla_component.edit&id=' . (int) $object->id . '" class="btn btn-small span12"><span class="icon-edit"></span> ' . JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' .$object->system_name . '</a></p>';
$html[] = '<a href="index.php?option=com_componentbuilder&ref=compiler&view=joomla_components&task=joomla_component.edit&id=' . (int) $object->id . '" class="btn btn-small span12"><span class="icon-edit"></span> ' . Text::_('COM_COMPONENTBUILDER_EDIT') . ' ' .$object->system_name . '</a></p>';
// now return the diplay
return implode("\n", $html);
}
@ -247,7 +238,7 @@ class ComponentbuilderModelAjax extends ListModel
**/
public function getCronPath($type)
{
$result = array('error' => '<span style="color: red;">' . JText::_('COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_SINCE_INCORRECT_TYPE_REQUESTED') . '</span>');
$result = array('error' => '<span style="color: red;">' . Text::_('COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_SINCE_INCORRECT_TYPE_REQUESTED') . '</span>');
if ('backup' === $type)
{
$result['error'] = '<span style="color: red;">' . JText::sprintf('COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_FOR_S', $type) . '</span>';
@ -284,25 +275,16 @@ class ComponentbuilderModelAjax extends ListModel
public function getWiki($name = 'Home')
{
// get the token if set
$token = JComponentHelper::getParams('com_componentbuilder')->get('gitea_token', false);
// setup a registry
$options = new Registry;
// only add if token is set
if ($token)
{
$options->set('access.token', $token);
}
try
{
// get gitea object
$gitea = new Gitea($options);
// load the API details
GiteaFactory::_('Gitea.Repository.Wiki')->load_('https://git.vdm.dev', '');
// get the gitea wiki page TODO: we hard coded the page name
$page = $gitea->repo->wiki->getHtml('joomla', 'Component-Builder', 'Home');
// get the gitea wiki page im markdown
$wiki = GiteaFactory::_('Gitea.Repository.Wiki')->get('joomla', 'Component-Builder', 'Home');
// now render the page in HTML
$page = GiteaFactory::_('Gitea.Miscellaneous.Markdown')->render($wiki->content, true);
}
catch (DomainException $e)
{
@ -333,26 +315,24 @@ class ComponentbuilderModelAjax extends ListModel
return ['error' => $message];
}
return ['error' => JText::_('COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION')];
return ['error' => Text::_('COM_COMPONENTBUILDER_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION')];
}
public function getVersion($version = null)
{
// get the token if set
$token = JComponentHelper::getParams('com_componentbuilder')->get('gitea_token', false);
$token = $this->app_params->get('gitea_token', false);
// only add if token is set
if ($token)
{
// setup a registry
$options = new Registry;
$options->set('access.token', $token);
// get the gitea http
try
{
// get gitea object
$gitea = new Gitea($options);
// get a list of all the repos tags
$tags = $gitea->repo->getListTags('joomla', 'Component-Builder');
// load the API details
GiteaFactory::_('Gitea.Repository.Tags')->load_('https://git.vdm.dev', $token);
// get the repository tags
$tags = GiteaFactory::_('Gitea.Repository.Tags')->list('joomla', 'Component-Builder');
}
catch (DomainException $e)
{
@ -377,7 +357,7 @@ class ComponentbuilderModelAjax extends ListModel
// now check if this version is out dated
if ($current_version === $local_version)
{
return ['notice' => '<small><span style="color:green;"><span class="icon-shield"></span>' . JText::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '</span></small>'];
return ['notice' => '<small><span style="color:green;"><span class="icon-shield"></span>' . Text::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '</span></small>'];
}
else
{
@ -388,15 +368,15 @@ class ComponentbuilderModelAjax extends ListModel
($local_array[0] == $current_array[0] && $local_array[1] > $current_array[1]) ||
($local_array[0] == $current_array[0] && $local_array[1] == $current_array[1] && $local_array[2] > $current_array[2]))
{
return ['notice' => '<small><span style="color:#F7B033;"><span class="icon-wrench"></span>' . JText::_('COM_COMPONENTBUILDER_BETA_RELEASE') . '</span></small>'];
return ['notice' => '<small><span style="color:#F7B033;"><span class="icon-wrench"></span>' . Text::_('COM_COMPONENTBUILDER_BETA_RELEASE') . '</span></small>'];
}
else
{
// download link of the latest version
$download = "https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/" . $tags[0]->name . ".zip?access_token=" . $token;
return ['notice' => '<small><span style="color:red;"><span class="icon-warning-circle"></span>' . JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '!</span> <a style="color:green;" href="' .
$download . '" title="' . JText::_('COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA') . '">' . JText::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!</a></small>'];
return ['notice' => '<small><span style="color:red;"><span class="icon-warning-circle"></span>' . Text::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '!</span> <a style="color:green;" href="' .
$download . '" title="' . Text::_('COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA') . '">' . Text::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!</a></small>'];
}
}
}
@ -416,11 +396,12 @@ class ComponentbuilderModelAjax extends ListModel
if ($message)
{
return ['error' => $a . $message . $a_ . JText::_('COM_COMPONENTBUILDER_GET_TOKEN') . $_a];
return ['error' => $a . $message . $a_ . Text::_('COM_COMPONENTBUILDER_GET_TOKEN') . $_a];
}
return ['error' => $a . JText::_('COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_TO_GET_UPDATE_NOTICE_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS') . $a_ . JText::_('COM_COMPONENTBUILDER_GET_TOKEN') . $_a];
return ['error' => $a . Text::_('COM_COMPONENTBUILDER_GET_TOKEN_FROM_VDM_TO_GET_UPDATE_NOTICE_AND_ADD_IT_TO_YOUR_GLOBAL_OPTIONS') . $a_ . Text::_('COM_COMPONENTBUILDER_GET_TOKEN') . $_a];
}
// Used in joomla_module

View File

@ -15,7 +15,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Utilities\ArrayHelper;
use Joomla\Registry\Registry;
use VDM\Gitea\Gitea;
/**
* Componentbuilder List Model

View File

@ -14,6 +14,8 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
/**
* Custom_admin_views List Model
@ -68,7 +70,7 @@ class ComponentbuilderModelCustom_admin_views extends ListModel
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -'
);
// check if we have joomla components
if (($joomla_components = ComponentbuilderHelper::getByTypeTheIdsSystemNames('joomla_component')) !== false)
if (($joomla_components = JCBFilterHelper::names('joomla_component')) !== null)
{
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -'
@ -77,7 +79,7 @@ class ComponentbuilderModelCustom_admin_views extends ListModel
$options = $options + $joomla_components;
}
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
$form->setValue(
'joomla_component',
'filter',
@ -293,7 +295,7 @@ class ComponentbuilderModelCustom_admin_views extends ListModel
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_custom_admin_views')) !== false)
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_custom_admin_views')) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
@ -498,7 +500,7 @@ class ComponentbuilderModelCustom_admin_views extends ListModel
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_custom_admin_views')) !== false)
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_custom_admin_views')) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}

View File

@ -14,6 +14,8 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
/**
* Fields List Model
@ -63,7 +65,7 @@ class ComponentbuilderModelFields extends ListModel
// Create the "extension" filter
$form->setField(new SimpleXMLElement(
ComponentbuilderHelper::getExtensionGroupedListXml()
JCBFilterHelper::extensions()
),'filter');
$form->setValue(
'extension',
@ -82,7 +84,7 @@ class ComponentbuilderModelFields extends ListModel
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_ADMIN_VIEWS_FOUND') . ' -'
);
// check if we have admin views (and limit to an extension if it is set)
if (($admin_views = ComponentbuilderHelper::getByTypeTheIdsSystemNames('admin_view', $this->state->get("filter.extension"))) !== false)
if (($admin_views = JCBFilterHelper::names('admin_view', $this->state->get("filter.extension"))) !== null)
{
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_ADMIN_VIEW') . ' -'
@ -91,7 +93,7 @@ class ComponentbuilderModelFields extends ListModel
$options = $options + $admin_views;
}
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
$form->setValue(
'admin_view',
'filter',
@ -100,7 +102,8 @@ class ComponentbuilderModelFields extends ListModel
array_push($this->filter_fields, 'admin_view');
return $form;
}
}
/**
* Method to auto-populate the model state.
@ -379,7 +382,7 @@ class ComponentbuilderModelFields extends ListModel
{
// column name, and id
$type_extension = explode('__', $filter_extension);
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($type_extension[1], $type_extension[0])) !== false)
if (($ids = JCBFilterHelper::linked((int) $type_extension[1], (string) $type_extension[0])) !== null)
{
$field_ids = $ids;
}
@ -395,7 +398,7 @@ class ComponentbuilderModelFields extends ListModel
$filter_admin_view = $this->state->get("filter.admin_view");
if ($get_ids && $filter_admin_view !== null && !empty($filter_admin_view))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_admin_view, 'admin_view')) !== false)
if (($ids = JCBFilterHelper::linked((int) $filter_admin_view, 'admin_view')) !== null)
{
// view will return less fields, so we ignore the component
$field_ids = $ids;
@ -644,7 +647,7 @@ class ComponentbuilderModelFields extends ListModel
{
// column name, and id
$type_extension = explode('__', $filter_extension);
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($type_extension[1], $type_extension[0])) !== false)
if (($ids = JCBFilterHelper::linked((int) $type_extension[1], (string) $type_extension[0])) !== null)
{
$field_ids = $ids;
}
@ -660,7 +663,7 @@ class ComponentbuilderModelFields extends ListModel
$filter_admin_view = $this->state->get("filter.admin_view");
if ($get_ids && $filter_admin_view !== null && !empty($filter_admin_view))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_admin_view, 'admin_view')) !== false)
if (($ids = JCBFilterHelper::linked((int) $filter_admin_view, 'admin_view')) !== null)
{
// view will return less fields, so we ignore the component
$field_ids = $ids;

View File

@ -17,16 +17,16 @@ jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Powersfilterpowerversion Form Field class for the Componentbuilder component
* Powersfilterapproved Form Field class for the Componentbuilder component
*/
class JFormFieldPowersfilterpowerversion extends JFormFieldList
class JFormFieldPowersfilterapproved extends JFormFieldList
{
/**
* The powersfilterpowerversion field type.
* The powersfilterapproved field type.
*
* @var string
*/
public $type = 'powersfilterpowerversion';
public $type = 'powersfilterapproved';
/**
* Method to get a list of options for a list input.
@ -42,24 +42,28 @@ class JFormFieldPowersfilterpowerversion extends JFormFieldList
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('power_version'));
$query->select($db->quoteName('approved'));
$query->from($db->quoteName('#__componentbuilder_power'));
$query->order($db->quoteName('power_version') . ' ASC');
$query->order($db->quoteName('approved') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_VERSION') . ' -');
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_SUPER_POWER') . ' -');
if ($results)
{
// get powersmodel
$model = ComponentbuilderHelper::getModel('powers');
$results = array_unique($results);
foreach ($results as $power_version)
foreach ($results as $approved)
{
// Now add the power_version and its text to the options array
$_filter[] = JHtml::_('select.option', $power_version, $power_version);
// Translate the approved selection
$text = $model->selectionTranslation($approved,'approved');
// Now add the approved and its text to the options array
$_filter[] = JHtml::_('select.option', $approved, JText::_($text));
}
}
return $_filter;

View File

@ -0,0 +1,100 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @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
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// Import the checkboxes field type classes needed
JFormHelper::loadFieldClass('checkboxes');
use VDM\Joomla\Utilities\Component\Helper;
/**
* Superpowerpaths Form Field class for the Componentbuilder component
*/
class JFormFieldSuperpowerpaths extends JFormFieldCheckboxes
{
/**
* The superpowerpaths field type.
*
* @var string
*/
public $type = 'superpowerpaths';
// A DynamicCheckboxes@ Field
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 3.5
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
// True if the field has 'value' set. In other words, it has been stored, don't use the default values.
$hasValue = (isset($this->value) && !empty($this->value));
// If a value has been stored, use it. Otherwise, use the defaults.
$checkedOptions = $hasValue ? $this->value : $this->checkedOptions;
// get the form options
$options = [];
// get the component params
$params = Helper::getParams();
$activate = $params->get('super_powers_repositories', 0);
// set the default
$default = $params->get('super_powers_core', 'joomla/super-powers');
// must have one / in the path
if (strpos($default, '/') !== false)
{
$tmp = new stdClass;
$tmp->text = $tmp->value = trim($default);
$tmp->checked = false;
$options[$tmp->value] = $tmp;
}
if ($activate == 1)
{
$subform = $params->get($this->fieldname);
// add the paths found in global settings
if (is_object($subform))
{
foreach ($subform as $value)
{
if (isset($value->owner) && strlen($value->owner) > 1 &&
isset($value->repo) && strlen($value->repo) > 1)
{
$tmp = new stdClass;
$tmp->text = $tmp->value = trim($value->owner) . '/' . trim($value->repo);
$tmp->checked = false;
$options[$tmp->value] = $tmp;
}
}
}
}
$extraData = array(
'checkedOptions' => is_array($checkedOptions) ? $checkedOptions : explode(',', (string) $checkedOptions),
'hasValue' => $hasValue,
'options' => array_values($options)
);
return array_merge($data, $extraData);
}
}

View File

@ -271,7 +271,7 @@ class ComponentbuilderModelFieldtype extends AdminModel
{
// column name, and id
$type_extension = explode('__', $filter_extension);
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($type_extension[1], $type_extension[0])) !== false)
if (($ids = JCBFilterHelper::linked((int) $type_extension[1], (string) $type_extension[0])) !== null)
{
$field_ids = $ids;
}
@ -287,7 +287,7 @@ class ComponentbuilderModelFieldtype extends AdminModel
$filter_admin_view = $this->state->get("filter.admin_view");
if ($get_ids && $filter_admin_view !== null && !empty($filter_admin_view))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_admin_view, 'admin_view')) !== false)
if (($ids = JCBFilterHelper::linked((int) $filter_admin_view, 'admin_view')) !== null)
{
// view will return less fields, so we ignore the component
$field_ids = $ids;

View File

@ -86,8 +86,8 @@
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.system_name ASC">COM_COMPONENTBUILDER_FILTER_SYSTEM_NAME_ASCENDING</option>
<option value="a.system_name DESC">COM_COMPONENTBUILDER_FILTER_SYSTEM_NAME_DESCENDING</option>
<option value="a.name_single ASC">COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORD_NAMING_CONVENTIONS_ASCENDING</option>
<option value="a.name_single DESC">COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORD_NAMING_CONVENTIONS_DESCENDING</option>
<option value="a.name_single ASC">COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORDNAMING_CONVENTIONS_ASCENDING</option>
<option value="a.name_single DESC">COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORDNAMING_CONVENTIONS_DESCENDING</option>
<option value="a.short_description ASC">COM_COMPONENTBUILDER_FILTER_SHORT_DESCRIPTION_ASCENDING</option>
<option value="a.short_description DESC">COM_COMPONENTBUILDER_FILTER_SHORT_DESCRIPTION_DESCENDING</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>

View File

@ -66,8 +66,8 @@
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.system_name ASC">COM_COMPONENTBUILDER_FILTER_SYSTEM_NAME_ASCENDING</option>
<option value="a.system_name DESC">COM_COMPONENTBUILDER_FILTER_SYSTEM_NAME_DESCENDING</option>
<option value="a.name_code ASC">COM_COMPONENTBUILDER_FILTER_NAME_IN_CODE_NAMING_CONVENTIONS_ASCENDING</option>
<option value="a.name_code DESC">COM_COMPONENTBUILDER_FILTER_NAME_IN_CODE_NAMING_CONVENTIONS_DESCENDING</option>
<option value="a.name_code ASC">COM_COMPONENTBUILDER_FILTER_NAME_IN_CODENAMING_CONVENTIONS_ASCENDING</option>
<option value="a.name_code DESC">COM_COMPONENTBUILDER_FILTER_NAME_IN_CODENAMING_CONVENTIONS_DESCENDING</option>
<option value="a.short_description ASC">COM_COMPONENTBUILDER_FILTER_SHORT_DESCRIPTION_ASCENDING</option>
<option value="a.short_description DESC">COM_COMPONENTBUILDER_FILTER_SHORT_DESCRIPTION_DESCENDING</option>
<option value="a.companyname ASC">COM_COMPONENTBUILDER_FILTER_COMPANY_NAME_ASCENDING</option>

View File

@ -39,16 +39,9 @@
onchange="this.form.submit();"
/>
<field
type="powersfilterpowerversion"
name="power_version"
label="COM_COMPONENTBUILDER_POWER_POWER_VERSION_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<field
type="classpowers"
name="extends"
label="COM_COMPONENTBUILDER_POWER_EXTENDS_LABEL"
type="powersfilterapproved"
name="approved"
label="COM_COMPONENTBUILDER_POWER_APPROVED_LABEL"
multiple="false"
onchange="this.form.submit();"
/>

View File

@ -159,6 +159,38 @@
message="COM_COMPONENTBUILDER_POWER_POWER_VERSION_MESSAGE"
hint="COM_COMPONENTBUILDER_POWER_POWER_VERSION_HINT"
/>
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="一_一"
/>
<!-- Method_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
name="method_selection"
label="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_DESCRIPTION"
icon="list"
max="150"
min="0">
<form hidden="true" name="list_method_selection_modal" repeat="true">
<!-- Method Field. Type: Pluginsclassmethods. (custom) -->
<field
type="pluginsclassmethods"
name="method"
label="COM_COMPONENTBUILDER_POWER_METHOD_LABEL"
class="list_class span12 method_selection_list"
multiple="false"
default="0"
onchange="getClassCode(this, 'method');"
button="false"
/>
</form>
</field>
<!-- Load_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -184,20 +216,8 @@
/>
</form>
</field>
<!-- Load_powers_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="load_powers_note" label="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_DESCRIPTION" heading="h4" class="alert alert-info load_powers_note" />
<!-- Description Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="description"
label="COM_COMPONENTBUILDER_POWER_DESCRIPTION_LABEL"
rows="11"
cols="10"
description="COM_COMPONENTBUILDER_POWER_DESCRIPTION_DESCRIPTION"
class="text_area span12"
filter="HTML"
hint="COM_COMPONENTBUILDER_POWER_DESCRIPTION_HINT"
/>
<!-- Note_linked_to_notice Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_linked_to_notice" label="COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_LABEL" description="COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_DESCRIPTION" heading="h4" class="note_linked_to_notice" />
<!-- Licensing_template Field. Type: Textarea. (joomla) -->
<field
type="textarea"
@ -211,6 +231,20 @@
validate="code"
showon="add_licensing_template:2"
/>
<!-- Description Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="description"
label="COM_COMPONENTBUILDER_POWER_DESCRIPTION_LABEL"
rows="11"
cols="10"
description="COM_COMPONENTBUILDER_POWER_DESCRIPTION_DESCRIPTION"
class="text_area span12"
filter="HTML"
hint="COM_COMPONENTBUILDER_POWER_DESCRIPTION_HINT"
/>
<!-- Note_approved_paths Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_approved_paths" label="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_LABEL" description="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_DESCRIPTION" heading="h4" class="alert alert-info note_approved_paths" showon="approved:1" />
<!-- Composer Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -268,6 +302,33 @@
</field>
</form>
</field>
<!-- Extends Field. Type: Classpowers. (custom) -->
<field
type="classpowers"
name="extends"
label="COM_COMPONENTBUILDER_POWER_EXTENDS_LABEL"
description="COM_COMPONENTBUILDER_POWER_EXTENDS_DESCRIPTION"
class="list_class span12"
multiple="false"
default="0"
showon="type:class[OR]type:abstract class[OR]type:final class"
button="true"
/>
<!-- Approved Field. Type: Radio. (joomla) -->
<field
type="radio"
name="approved"
label="COM_COMPONENTBUILDER_POWER_APPROVED_LABEL"
description="COM_COMPONENTBUILDER_POWER_APPROVED_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="0">
COM_COMPONENTBUILDER_POWER_NOT_APPROVED</option>
<option value="1">
COM_COMPONENTBUILDER_POWER_APPROVED</option>
</field>
<!-- Property_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -308,6 +369,20 @@
<option value="0">
COM_COMPONENTBUILDER_POWER_NO</option>
</field>
<!-- Extends_custom Field. Type: Text. (joomla) -->
<field
type="text"
name="extends_custom"
label="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_LABEL"
size="10"
maxlength="50"
description="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_DESCRIPTION"
class="text_area span12"
filter="STRING"
message="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_MESSAGE"
autocomplete="on"
showon="extends:-1[AND]type!:trait[AND]type!:interface"
/>
<!-- Implements_custom Field. Type: Text. (joomla) -->
<field
type="text"
@ -334,66 +409,6 @@
showon="type!:interface[AND]type!:trait"
button="true"
/>
<!-- Extends_custom Field. Type: Text. (joomla) -->
<field
type="text"
name="extends_custom"
label="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_LABEL"
size="10"
maxlength="50"
description="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_DESCRIPTION"
class="text_area span12"
filter="STRING"
message="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_MESSAGE"
autocomplete="on"
showon="extends:-1[AND]type!:trait[AND]type!:interface"
/>
<!-- Extends Field. Type: Classpowers. (custom) -->
<field
type="classpowers"
name="extends"
label="COM_COMPONENTBUILDER_POWER_EXTENDS_LABEL"
description="COM_COMPONENTBUILDER_POWER_EXTENDS_DESCRIPTION"
class="list_class span12"
multiple="false"
default="0"
showon="type:class[OR]type:abstract class[OR]type:final class"
button="true"
/>
<!-- Note_linked_to_notice Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_linked_to_notice" label="COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_LABEL" description="COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_DESCRIPTION" heading="h4" class="note_linked_to_notice" />
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="一_一"
/>
<!-- Method_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
name="method_selection"
label="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_DESCRIPTION"
icon="list"
max="150"
min="0">
<form hidden="true" name="list_method_selection_modal" repeat="true">
<!-- Method Field. Type: Pluginsclassmethods. (custom) -->
<field
type="pluginsclassmethods"
name="method"
label="COM_COMPONENTBUILDER_POWER_METHOD_LABEL"
class="list_class span12 method_selection_list"
multiple="false"
default="0"
onchange="getClassCode(this, 'method');"
button="false"
/>
</form>
</field>
<!-- Namespace_details Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="namespace_details" label="COM_COMPONENTBUILDER_POWER_NAMESPACE_DETAILS_LABEL" description="COM_COMPONENTBUILDER_POWER_NAMESPACE_DETAILS_DESCRIPTION" heading="h4" class="alert alert-success namespace_details" />
<!-- Head Field. Type: Editor. (joomla) -->
@ -413,8 +428,18 @@
required="false"
validate="code"
/>
<!-- Autoload_composer_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="autoload_composer_note" label="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_DESCRIPTION" heading="h4" class="alert alert-info autoload_composer_note" />
<!-- Approved_paths Field. Type: Superpowerpaths. (custom) -->
<field
type="superpowerpaths"
name="approved_paths"
label="COM_COMPONENTBUILDER_POWER_APPROVED_PATHS_LABEL"
description="COM_COMPONENTBUILDER_POWER_APPROVED_PATHS_DESCRIPTION"
required="false"
showon="approved:1">
<!-- Option Set. -->
<option value="joomla/super-powers">
COM_COMPONENTBUILDER_POWER_JOOMLASUPERPOWERS</option>
</field>
<!-- Use_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -452,21 +477,8 @@
/>
</form>
</field>
<!-- Add_licensing_template Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_licensing_template"
label="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_LABEL"
description="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_POWER_USE_GLOBAL</option>
<option value="2">
COM_COMPONENTBUILDER_POWER_OVERRIDE</option>
</field>
<!-- Autoload_composer_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="autoload_composer_note" label="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_DESCRIPTION" heading="h4" class="alert alert-info autoload_composer_note" />
<!-- Main_class_code Field. Type: Editor. (joomla) -->
<field
type="editor"
@ -483,6 +495,23 @@
filter="raw"
validate="code"
/>
<!-- Add_licensing_template Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_licensing_template"
label="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_LABEL"
description="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_POWER_USE_GLOBAL</option>
<option value="2">
COM_COMPONENTBUILDER_POWER_OVERRIDE</option>
</field>
<!-- Load_powers_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="load_powers_note" label="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_DESCRIPTION" heading="h4" class="alert alert-info load_powers_note" />
<!-- Guid Field. Type: Text. (joomla) -->
<field
type="text"

View File

@ -18,7 +18,7 @@ use Joomla\CMS\Filesystem\Folder;
use Joomla\Utilities\ArrayHelper;
use PhpOffice\PhpSpreadsheet\IOFactory;
/**
/***
* Componentbuilder Import Base Database Model
*/
class ComponentbuilderModelImport extends BaseDatabaseModel

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,12 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\ArrayHelper as JCBArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\JsonHelper;
/**
* Joomla_components List Model
@ -112,14 +118,14 @@ class ComponentbuilderModelJoomla_components extends ListModel
}
// has any data been set for this component
if (ComponentbuilderHelper::checkArray($pks))
if (JCBArrayHelper::check($pks))
{
// load the linked stuff
$this->getLinkedToComponents($pks);
}
// has any data been set for this component
if (isset($this->smartBox['joomla_component']) && ComponentbuilderHelper::checkArray($this->smartBox['joomla_component']))
if (isset($this->smartBox['joomla_component']) && JCBArrayHelper::check($this->smartBox['joomla_component']))
{
// set the folder and move the files of each component to the folder
return $this->smartCloner();
@ -181,25 +187,22 @@ class ComponentbuilderModelJoomla_components extends ListModel
$this->packageName = 'JCB_smartPackage';
}
}
// set the package path
$this->packagePath = rtrim($this->backupPath, '/') . '/' . $this->packageName;
$this->zipPath = rtrim($this->zipPath, '/') . '/' . $this->packageName .'.zip';
if (JFolder::exists($this->packagePath))
if (FileHelper::exists($this->packagePath))
{
// remove if old folder is found
ComponentbuilderHelper::removeFolder($this->packagePath);
}
// create the folders
JFolder::create($this->packagePath);
// Get the basic encryption.
$basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encryption object.
if ($basickey)
{
$basic = new FOFEncryptAes($basickey, 128);
}
// update $pks with returned IDs
$pks = array();
// start loading the components
$this->smartBox['joomla_component'] = array();
foreach ($items as $nr => &$item)
@ -211,8 +214,10 @@ class ComponentbuilderModelJoomla_components extends ListModel
unset($items[$nr]);
continue;
}
// make sure old fields are not exported any more
$this->removeOldComponentValues($item);
// build information data set
$this->info['name'][$item->id] = $item->name;
$this->info['short_description'][$item->id] = $item->short_description;
@ -223,14 +228,15 @@ class ComponentbuilderModelJoomla_components extends ListModel
$this->info['website'][$item->id] = $item->website;
$this->info['license'][$item->id] = $item->license;
$this->info['copyright'][$item->id] = $item->copyright;
// set the keys
if (isset($item->export_key) && ComponentbuilderHelper::checkString($item->export_key))
if (isset($item->export_key) && StringHelper::check($item->export_key))
{
// keep the key locked for exported data set
$export_key = $item->export_key;
if ($basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true)))
if (!is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true)))
{
$export_key = rtrim($basic->decryptString($item->export_key), "\0");
$export_key = PackageFactory::_('Crypt')->decrypt($item->export_key, 'basic');
}
// make sure we have a string
if (strlen($export_key) > 4 )
@ -238,27 +244,31 @@ class ComponentbuilderModelJoomla_components extends ListModel
$this->key[$item->id] = $export_key;
}
}
// get name of this item key_name
if (isset($item->system_name))
{
$keyName = ComponentbuilderHelper::safeString($item->system_name, 'cAmel');
$keyName = StringHelper::safe($item->system_name, 'cAmel');
}
else
{
$keyName = ComponentbuilderHelper::safeString($item->name_code);
$keyName = StringHelper::safe($item->name_code);
}
// set the export buy links
if (isset($item->export_buy_link) && ComponentbuilderHelper::checkString($item->export_buy_link))
if (isset($item->export_buy_link) && StringHelper::check($item->export_buy_link))
{
// set the export buy link
$this->info['export_buy_link'][$item->id] = $item->export_buy_link;
}
// set the export buy links
if (isset($item->joomla_source_link) && ComponentbuilderHelper::checkString($item->joomla_source_link))
if (isset($item->joomla_source_link) && StringHelper::check($item->joomla_source_link))
{
// set the source link
$this->info['joomla_source_link'][$item->id] = $item->joomla_source_link;
}
// component image
$this->moveIt(array($item->image), 'image');
// set the custom code ID's
@ -276,14 +286,14 @@ class ComponentbuilderModelJoomla_components extends ListModel
}
// has any data been set for this component
if (ComponentbuilderHelper::checkArray($pks))
if (JCBArrayHelper::check($pks))
{
// load the linked stuff
$this->getLinkedToComponents($pks);
}
// has any data been set for this component
if (isset($this->smartBox['joomla_component']) && ComponentbuilderHelper::checkArray($this->smartBox['joomla_component']))
if (isset($this->smartBox['joomla_component']) && JCBArrayHelper::check($this->smartBox['joomla_component']))
{
// set the folder and move the files of each component to the folder
return $this->smartExportBuilder();
@ -320,7 +330,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
$this->setData($table, $pks, $field);
}
// add fields conditions and relations
if (isset($this->smartIDs['admin_view']) && ComponentbuilderHelper::checkArray($this->smartIDs['admin_view']))
if (isset($this->smartIDs['admin_view']) && JCBArrayHelper::check($this->smartIDs['admin_view']))
{
$this->setData('admin_fields', array_values($this->smartIDs['admin_view']), 'admin_view');
$this->setData('admin_fields_conditions', array_values($this->smartIDs['admin_view']), 'admin_view');
@ -328,41 +338,41 @@ class ComponentbuilderModelJoomla_components extends ListModel
$this->setData('admin_custom_tabs', array_values($this->smartIDs['admin_view']), 'admin_view');
}
// add joomla module
if (isset($this->smartIDs['joomla_module']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_module']))
if (isset($this->smartIDs['joomla_module']) && JCBArrayHelper::check($this->smartIDs['joomla_module']))
{
$this->setData('joomla_module', array_values($this->smartIDs['joomla_module']), 'id');
$this->setData('joomla_module_updates', array_values($this->smartIDs['joomla_module']), 'joomla_module');
$this->setData('joomla_module_files_folders_urls', array_values($this->smartIDs['joomla_module']), 'joomla_module');
}
// add joomla plugin
if (isset($this->smartIDs['joomla_plugin']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_plugin']))
if (isset($this->smartIDs['joomla_plugin']) && JCBArrayHelper::check($this->smartIDs['joomla_plugin']))
{
$this->setData('joomla_plugin', array_values($this->smartIDs['joomla_plugin']), 'id');
$this->setData('joomla_plugin_updates', array_values($this->smartIDs['joomla_plugin']), 'joomla_plugin');
$this->setData('joomla_plugin_files_folders_urls', array_values($this->smartIDs['joomla_plugin']), 'joomla_plugin');
}
// add validation rules
if (isset($this->smartIDs['validation_rule']) && ComponentbuilderHelper::checkArray($this->smartIDs['validation_rule']))
if (isset($this->smartIDs['validation_rule']) && JCBArrayHelper::check($this->smartIDs['validation_rule']))
{
$this->setData('validation_rule', array_values($this->smartIDs['validation_rule']), 'name');
}
// add field types
if (isset($this->smartIDs['fieldtype']) && ComponentbuilderHelper::checkArray($this->smartIDs['fieldtype']))
if (isset($this->smartIDs['fieldtype']) && JCBArrayHelper::check($this->smartIDs['fieldtype']))
{
$this->setData('fieldtype', array_values($this->smartIDs['fieldtype']), 'id');
}
// add templates
if (isset($this->smartIDs['template']) && ComponentbuilderHelper::checkArray($this->smartIDs['template']))
if (isset($this->smartIDs['template']) && JCBArrayHelper::check($this->smartIDs['template']))
{
$this->setData('template', array_values($this->smartIDs['template']), 'id');
}
// add layouts
if (isset($this->smartIDs['layout']) && ComponentbuilderHelper::checkArray($this->smartIDs['layout']))
if (isset($this->smartIDs['layout']) && JCBArrayHelper::check($this->smartIDs['layout']))
{
$this->setData('layout', array_values($this->smartIDs['layout']), 'id');
}
// add dynamic get
if (isset($this->smartIDs['dynamic_get']) && ComponentbuilderHelper::checkArray($this->smartIDs['dynamic_get']))
if (isset($this->smartIDs['dynamic_get']) && JCBArrayHelper::check($this->smartIDs['dynamic_get']))
{
$this->setData('dynamic_get', array_values($this->smartIDs['dynamic_get']), 'id');
}
@ -370,49 +380,49 @@ class ComponentbuilderModelJoomla_components extends ListModel
if ('clone' !== $this->activeType)
{
// add class_property
if (isset($this->smartIDs['class_property']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_property']))
if (isset($this->smartIDs['class_property']) && JCBArrayHelper::check($this->smartIDs['class_property']))
{
$this->setData('class_property', array_values($this->smartIDs['class_property']), 'id');
}
// add class_method
if (isset($this->smartIDs['class_method']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_method']))
if (isset($this->smartIDs['class_method']) && JCBArrayHelper::check($this->smartIDs['class_method']))
{
$this->setData('class_method', array_values($this->smartIDs['class_method']), 'id');
}
// add joomla_plugin_group
if (isset($this->smartIDs['joomla_plugin_group']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_plugin_group']))
if (isset($this->smartIDs['joomla_plugin_group']) && JCBArrayHelper::check($this->smartIDs['joomla_plugin_group']))
{
$this->setData('joomla_plugin_group', array_values($this->smartIDs['joomla_plugin_group']), 'id');
}
// add class_extends
if (isset($this->smartIDs['class_extends']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_extends']))
if (isset($this->smartIDs['class_extends']) && JCBArrayHelper::check($this->smartIDs['class_extends']))
{
$this->setData('class_extends', array_values($this->smartIDs['class_extends']), 'id');
}
// add snippets
if (isset($this->smartIDs['snippet']) && ComponentbuilderHelper::checkArray($this->smartIDs['snippet']))
if (isset($this->smartIDs['snippet']) && JCBArrayHelper::check($this->smartIDs['snippet']))
{
$this->setData('snippet', array_values($this->smartIDs['snippet']), 'id');
}
// add custom code
if (isset($this->smartIDs['custom_code']) && ComponentbuilderHelper::checkArray($this->smartIDs['custom_code']))
if (isset($this->smartIDs['custom_code']) && JCBArrayHelper::check($this->smartIDs['custom_code']))
{
$this->setData('custom_code', array_values($this->smartIDs['custom_code']), 'id');
}
// add placeholder
if (isset($this->smartIDs['placeholder']) && ComponentbuilderHelper::checkArray($this->smartIDs['placeholder']))
if (isset($this->smartIDs['placeholder']) && JCBArrayHelper::check($this->smartIDs['placeholder']))
{
$this->setData('placeholder', array_values($this->smartIDs['placeholder']), 'id');
}
// add powers
if (isset($this->smartIDs['power']) && ComponentbuilderHelper::checkArray($this->smartIDs['power']))
if (isset($this->smartIDs['power']) && JCBArrayHelper::check($this->smartIDs['power']))
{
$this->setData('power', array_values($this->smartIDs['power']), 'guid');
}
// set limiter
$limit = 0;
// and add those custom codes found in custom codes
while (isset($this->smartIDs['custom_code']) && ComponentbuilderHelper::checkArray($this->smartIDs['custom_code']) && $limit < 100)
while (isset($this->smartIDs['custom_code']) && JCBArrayHelper::check($this->smartIDs['custom_code']) && $limit < 100)
{
$this->setData('custom_code', array_values($this->smartIDs['custom_code']), 'id');
// make sure we break
@ -429,15 +439,15 @@ class ComponentbuilderModelJoomla_components extends ListModel
protected function getComponents($pks)
{
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
if (JCBArrayHelper::check($pks))
{
// Get the user object.
if (!ComponentbuilderHelper::checkObject($this->user))
if (!ObjectHelper::check($this->user))
{
$this->user = JFactory::getUser();
}
// Create a new query object.
if (!ComponentbuilderHelper::checkObject($this->_db))
if (!ObjectHelper::check($this->_db))
{
$this->_db = JFactory::getDBO();
}
@ -468,10 +478,10 @@ class ComponentbuilderModelJoomla_components extends ListModel
// load the items from db
$items = $this->_db->loadObjectList();
// check if we have items
if (ComponentbuilderHelper::checkArray($items))
if (JCBArrayHelper::check($items))
{
// set params
if (!ComponentbuilderHelper::checkObject($this->params))
if (!ObjectHelper::check($this->params))
{
$this->params = JComponentHelper::getParams('com_componentbuilder');
}
@ -516,30 +526,30 @@ class ComponentbuilderModelJoomla_components extends ListModel
$this->smartIDs[$table] = array();
}
// convert if value is in json
if (ComponentbuilderHelper::checkJson($value))
if (JsonHelper::check($value))
{
$value = json_decode($value, true);
}
// now update the fields
if (ComponentbuilderHelper::checkArray($value))
if (JCBArrayHelper::check($value))
{
foreach ($value as $id)
{
if ($int && (ComponentbuilderHelper::checkString($id) || is_numeric($id)) && 0 !== (int) $id)
if ($int && (StringHelper::check($id) || is_numeric($id)) && 0 !== (int) $id)
{
$this->smartIDs[$table][(int) $id] = (int) $id;
}
elseif (!$int && ComponentbuilderHelper::checkString($id))
elseif (!$int && StringHelper::check($id))
{
$this->smartIDs[$table][$id] = $this->_db->quote($id);
}
}
}
elseif ($int && (ComponentbuilderHelper::checkString($value) || is_numeric($value)) && 0 !== (int) $value)
elseif ($int && (StringHelper::check($value) || is_numeric($value)) && 0 !== (int) $value)
{
$this->smartIDs[$table][(int) $value] = (int) $value;
}
elseif (!$int && ComponentbuilderHelper::checkString($value))
elseif (!$int && StringHelper::check($value))
{
$this->smartIDs[$table][$value] = $this->_db->quote($value);
}
@ -555,12 +565,12 @@ class ComponentbuilderModelJoomla_components extends ListModel
// the ids bucket
$bucket = array();
// if json convert to array
if (ComponentbuilderHelper::checkJson($values))
if (JsonHelper::check($values))
{
$values = json_decode($values, true);
}
// check that the array has values
if (ComponentbuilderHelper::checkArray($values))
if (JCBArrayHelper::check($values))
{
// check if the key is an array (targeting subform)
if ('subform' === $type && $key)
@ -573,7 +583,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
{
$bucket[] = $value[$key];
}
elseif (ComponentbuilderHelper::checkString($value[$key]))
elseif (StringHelper::check($value[$key]))
{
if ('table' === $prep)
{
@ -587,7 +597,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
}
}
// only return if we set the ids
if (ComponentbuilderHelper::checkArray($bucket))
if (JCBArrayHelper::check($bucket))
{
// now set the values back
return array_unique($bucket);
@ -599,7 +609,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
$_key = explode('.', $key);
foreach ($values as $value)
{
if (isset($value[$_key[0]]) && ComponentbuilderHelper::checkArray($value[$_key[0]]))
if (isset($value[$_key[0]]) && JCBArrayHelper::check($value[$_key[0]]))
{
foreach ($value[$_key[0]] as $_value)
{
@ -607,7 +617,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
{
$bucket[] = $_value[$_key[1]];
}
elseif (ComponentbuilderHelper::checkString($_value[$_key[1]]))
elseif (StringHelper::check($_value[$_key[1]]))
{
if ('table' === $prep)
{
@ -622,7 +632,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
}
}
// only return if we set the ids
if (ComponentbuilderHelper::checkArray($bucket))
if (JCBArrayHelper::check($bucket))
{
// now set the values back
return array_unique($bucket);
@ -638,7 +648,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
{
return $value;
}
elseif (ComponentbuilderHelper::checkString($value))
elseif (StringHelper::check($value))
{
if ('table' === $prep)
{
@ -659,11 +669,11 @@ class ComponentbuilderModelJoomla_components extends ListModel
{
foreach ($values[$key] as $k => $val)
{
if (strpos($k, 'power_') !== false && ComponentbuilderHelper::checkArray($val))
if (strpos($k, 'power_') !== false && JCBArrayHelper::check($val))
{
foreach ($val as $v)
{
if (ComponentbuilderHelper::checkArray($v) && isset($v['power']))
if (JCBArrayHelper::check($v) && isset($v['power']))
{
$bucket[$v['power']] = $v['power'];
}
@ -671,7 +681,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
}
}
// only return if we set the ids
if (ComponentbuilderHelper::checkArray($bucket))
if (JCBArrayHelper::check($bucket))
{
// now return the values back
return array_values($bucket);
@ -690,7 +700,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
protected function setData($table, $values, $key, $string = false)
{
// lets check for json strings
if (ComponentbuilderHelper::checkJson($values))
if (JsonHelper::check($values))
{
$values = json_decode($values, true);
}
@ -701,7 +711,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
}
// make sure we have an array of values
if (!ComponentbuilderHelper::checkArray($values, true) || !ComponentbuilderHelper::checkString($table) || !ComponentbuilderHelper::checkString($key))
if (!JCBArrayHelper::check($values, true) || !StringHelper::check($table) || !StringHelper::check($key))
{
return false;
}
@ -752,7 +762,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
// reset the search array (only search for template/layouts)
$searchTLArray = array();
// check if we have items
if (ComponentbuilderHelper::checkArray($items))
if (JCBArrayHelper::check($items))
{
// set search array if site/custom admin view
if ('site_view' === $table || 'custom_admin_view' === $table)
@ -904,7 +914,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
if ('component_modules' === $table)
{
// we remove those modules not part of the export
if (isset($item->addjoomla_modules) && ComponentbuilderHelper::checkJson($item->addjoomla_modules))
if (isset($item->addjoomla_modules) && JsonHelper::check($item->addjoomla_modules))
{
$item->addjoomla_modules = array_filter(
json_decode($item->addjoomla_modules, true),
@ -925,7 +935,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
if ('component_plugins' === $table)
{
// we remove those plugins not part of the export
if (isset($item->addjoomla_plugins) && ComponentbuilderHelper::checkJson($item->addjoomla_plugins))
if (isset($item->addjoomla_plugins) && JsonHelper::check($item->addjoomla_plugins))
{
$item->addjoomla_plugins = array_filter(
json_decode($item->addjoomla_plugins, true),
@ -1001,17 +1011,17 @@ class ComponentbuilderModelJoomla_components extends ListModel
$fieldsSets[] = (int) $fields;
}
// get fields
if (ComponentbuilderHelper::checkArray($fieldsSets))
if (JCBArrayHelper::check($fieldsSets))
{
$this->setData('field', $fieldsSets, 'id');
}
}
// check if validation rule is found
$validationRule = ComponentbuilderHelper::getBetween(json_decode($item->xml), 'validate="', '"');
if (ComponentbuilderHelper::checkString($validationRule))
if (StringHelper::check($validationRule))
{
// make sure it is lowercase
$validationRule = ComponentbuilderHelper::safeString($validationRule);
$validationRule = StringHelper::safe($validationRule);
// get core validation rules
if ($coreValidationRules = ComponentbuilderHelper::getExistingValidationRuleNames(true))
{
@ -1025,7 +1035,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
}
}
// check if a search is required
if (isset($searchTLArray) && ComponentbuilderHelper::checkArray($searchTLArray)){
if (isset($searchTLArray) && JCBArrayHelper::check($searchTLArray)){
// add search array templates and layouts
foreach ($searchTLArray as $scripter => $add)
@ -1181,7 +1191,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
protected function smartCloner()
{
// check if data is set
if (isset($this->smartBox) && ComponentbuilderHelper::checkArray($this->smartBox))
if (isset($this->smartBox) && JCBArrayHelper::check($this->smartBox))
{
// get the import_joomla_components
$model = ComponentbuilderHelper::getModel('import_joomla_components');
@ -1190,7 +1200,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
// trigger the create new (clone) feature
$model->canmerge = 0;
// set some postfix
$model->postfix = ' ('.ComponentbuilderHelper::randomkey(2).')';
$model->postfix = ' ('.StringHelper::random(2).')';
// get App
$model->app = JFactory::getApplication();
// set user
@ -1239,10 +1249,11 @@ class ComponentbuilderModelJoomla_components extends ListModel
protected function smartExportBuilder()
{
// check if data is set
if (isset($this->smartBox) && ComponentbuilderHelper::checkArray($this->smartBox))
if (isset($this->smartBox) && JCBArrayHelper::check($this->smartBox))
{
// set db data
$data = serialize($this->smartBox);
// Set the key owner information
$this->info['source'] = array();
$this->info['source']['company'] = $this->params->get('export_company', null);
@ -1251,26 +1262,16 @@ class ComponentbuilderModelJoomla_components extends ListModel
$this->info['source']['website'] = $this->params->get('export_website', null);
$this->info['source']['license'] = $this->params->get('export_license', null);
$this->info['source']['copyright'] = $this->params->get('export_copyright', null);
// lock the data if set
if (ComponentbuilderHelper::checkArray($this->key))
if (JCBArrayHelper::check($this->key))
{
// lock the data
$this->key = md5(implode('', $this->key));
// April 20, 2022 we moved away from FOF for good... sorry that it took this long
// $locker = new FOFEncryptAes($this->key, 128);
// $data = $locker->encryptString($data);
// load phpseclib <https://phpseclib.com/docs/symmetric>
if(ComponentbuilderHelper::crypt('AES', 'CBC') instanceof \phpseclib\Crypt\Rijndael)
{
// set the password
ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($this->key, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt');
// lock the data
$data = base64_encode(ComponentbuilderHelper::crypt('AES', 'CBC')->encrypt($data));
}
else
{
return false;
}
// lock the data
$data = PackageFactory::_('Crypt')->encrypt($data, 'aes', $this->key);
// Set the key owner information
$this->info['getKeyFrom'] = array();
$this->info['getKeyFrom']['company'] = $this->info['source']['company'];
@ -1280,13 +1281,16 @@ class ComponentbuilderModelJoomla_components extends ListModel
$this->info['getKeyFrom']['license'] = $this->info['source']['license'];
$this->info['getKeyFrom']['copyright'] = $this->info['source']['copyright'];
// add buy link if only one link is set
if (isset($this->info['export_buy_link']) && ComponentbuilderHelper::checkArray($this->info['export_buy_link']) && count((array) $this->info['export_buy_link']) == 1)
if (isset($this->info['export_buy_link'])
&& JCBArrayHelper::check($this->info['export_buy_link'])
&& count((array) $this->info['export_buy_link']) == 1)
{
$this->info['getKeyFrom']['buy_link'] = array_values($this->info['export_buy_link'])[0];
}
else
{
// use global if more then one component is exported (since they now have one key), or if none has a buy link
// use global if more then one component is exported
// (since they now have one key), or if none has a buy link
$this->info['getKeyFrom']['buy_link'] = $this->params->get('export_buy_link', null);
}
// no remove the buy links
@ -1294,75 +1298,82 @@ class ComponentbuilderModelJoomla_components extends ListModel
// if we have multi links add them also
// we started adding this at v2.7.7
$this->info['key'] = true;
// we started adding this at v3.0.11 and v2.12.17
$this->info['phpseclib'] = true;
// Changed: 25th Feb. 2023 at v3.1.18
// $this->info['phpseclib'] = false;
// we started adding this at v3.1.18
$this->info['phpseclib3'] = true;
}
else
{
// we started adding this at v2.7.7
$this->info['key'] = false;
// we started adding this at v3.0.11 and v2.12.17
$this->info['phpseclib'] = false;
// $this->info['phpseclib'] = false;
// we started adding this at v3.1.18
$this->info['phpseclib3'] = false;
// base 64 encode the data
$data = base64_encode($data);
}
// set the path
$dbPath = $this->packagePath . '/db.vdm';
// write the db data to file in package
if (!ComponentbuilderHelper::writeFile($dbPath, wordwrap($data, 128, "\n", true)))
if (!FileHelper::write($dbPath, wordwrap($data, 128, "\n", true)))
{
return false;
}
// set info data
if(ComponentbuilderHelper::crypt('AES', 'CBC') instanceof \phpseclib\Crypt\Rijndael)
// lock the info data
$info = PackageFactory::_('Crypt')->encrypt(json_encode($this->info), 'local');
// set the path
$infoPath = $this->packagePath . '/info.vdm';
// write the info data to file in package
if (!FileHelper::write($infoPath, wordwrap($info, 128, "\n", true)))
{
// set system password
$db = 'COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM';
$password = base64_decode(JText::sprintf($db, 'VjR', 'WV0aE9k'));
// set the password
ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($password, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt');
// lock the data
$info = base64_encode(ComponentbuilderHelper::crypt('AES', 'CBC')->encrypt(json_encode($this->info)));
// set the path
$infoPath = $this->packagePath . '/info.vdm';
// write the info data to file in package
if (!ComponentbuilderHelper::writeFile($infoPath, wordwrap($info, 128, "\n", true)))
{
return false;
}
}
else
{
return false;
return false;
}
// lock all files
$this->lockFiles();
// remove old zip files with the same name
if (JFile::exists($this->zipPath))
{
// remove file if found
JFile::delete($this->zipPath);
}
// zip the folder
if (!ComponentbuilderHelper::zip($this->packagePath, $this->zipPath))
if (!FileHelper::zip($this->packagePath, $this->zipPath))
{
return false;
}
// move to remote server if needed
if (2 == $this->backupType)
{
if (!ComponentbuilderHelper::moveToServer($this->zipPath, $this->packageName.'.zip', $this->backupServer, null, 'joomla_component.export'))
if (!PackageFactory::_('Server')->legacyMove(
$this->zipPath, $this->packageName.'.zip',
$this->backupServer, null, 'joomla_component.export'
)
)
{
return false;
}
// remove the local file
JFile::delete($this->zipPath);
}
// remove the folder
if (!ComponentbuilderHelper::removeFolder($this->packagePath))
{
return false;
}
return true;
}
return false;
@ -1376,25 +1387,27 @@ class ComponentbuilderModelJoomla_components extends ListModel
protected function lockFiles()
{
// lock the data if set
if (ComponentbuilderHelper::checkString($this->key) && strlen($this->key) == 32)
if (StringHelper::check($this->key) && strlen($this->key) == 32)
{
// set secure password
ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($this->key, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt');
// we must first store the current working directory
$joomla = getcwd();
// to avoid that it encrypt the db and info file again we must move per/folder
$folders = array('images', 'custom', 'dynamic');
// loop the folders
foreach ($folders as $folder)
{
// the sub path
$subPath = $this->packagePath.'/'.$folder;
// go to the package sub folder if found
if (JFolder::exists($subPath))
if (FileHelper::exists($subPath))
{
$this->lock($subPath);
}
}
// change back to working dir
chdir($joomla);
}
@ -1409,16 +1422,21 @@ class ComponentbuilderModelJoomla_components extends ListModel
{
// we are changing the working directory to the tmp path (important)
chdir($tmpPath);
// get a list of files in the current directory tree (all)
$files = JFolder::files('.', '.', true, true);
// read in the file content
foreach ($files as $file)
{
// get file content
$content = FileHelper::getContent($file);
// write the encrypted string back to file
if (!ComponentbuilderHelper::writeFile($file, wordwrap(base64_encode(ComponentbuilderHelper::crypt('AES', 'CBC')->encrypt(file_get_contents($file))), 128, "\n", true)))
{
// we should add error handler here in case file could not be locked
}
$content = PackageFactory::_('Crypt')->encrypt($content, 'eac', $this->key);
// store the encrypted file content in the same file
FileHelper::write($file, wordwrap($content, 128, "\n", true));
}
}
@ -1430,10 +1448,11 @@ class ComponentbuilderModelJoomla_components extends ListModel
protected function moveIt($paths, $type, $dynamic = false)
{
// make sure we have an array
if (!ComponentbuilderHelper::checkArray($paths))
if (!JCBArrayHelper::check($paths))
{
return false;
}
// set the name of the folder
if ('file' === $type || 'folder' === $type)
{
@ -1452,19 +1471,22 @@ class ComponentbuilderModelJoomla_components extends ListModel
{
return false;
}
// setup the type path
$tmpPath = str_replace('//', '/', $this->packagePath . '/' . $folderName);
// create type path if not set
if (!JFolder::exists($tmpPath))
if (!FileHelper::exists($tmpPath))
{
// create the folders if not found
JFolder::create($tmpPath);
}
// now move it
foreach ($paths as $item)
{
// make sure we have a string
if (ComponentbuilderHelper::checkString($item))
if (StringHelper::check($item))
{
// if the file type
if ('file' === $type)
@ -1487,14 +1509,16 @@ class ComponentbuilderModelJoomla_components extends ListModel
JFile::copy($customFilePath, $tmpFilePath);
}
}
// if the image type
if ('image' === $type)
{
$imageName = basename($item);
$imagePath = str_replace($imageName, '', $item);
$imageFolderPath = str_replace('//', '/', $this->packagePath.'/'. $imagePath);
// check if image folder exist
if (!JFolder::exists($imageFolderPath))
if (!FileHelper::exists($imageFolderPath))
{
// create the folders if not found
JFolder::create($imageFolderPath);
@ -1507,6 +1531,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
JFile::copy($customImagePath, $tmpImagePath);
}
}
// if the folder type
if ('folder' === $type)
{
@ -1521,7 +1546,8 @@ class ComponentbuilderModelJoomla_components extends ListModel
$tmpFolderPath = str_replace('//', '/', $tmpPath.'/'.$item);
$customFolderPath = str_replace('//', '/', $this->customPath.'/'.$item);
}
if (!JFolder::exists($tmpFolderPath) && JFolder::exists($customFolderPath))
if (!FileHelper::exists($tmpFolderPath) && FileHelper::exists($customFolderPath))
{
// move the folder to its place
JFolder::copy($customFolderPath, $tmpFolderPath,'',true);
@ -1574,14 +1600,14 @@ class ComponentbuilderModelJoomla_components extends ListModel
if (!isset($this->fieldTypes[$id]))
{
$properties = ComponentbuilderHelper::getVar('fieldtype', $id, 'id', 'properties');
if (ComponentbuilderHelper::checkJson($properties))
if (JsonHelper::check($properties))
{
$properties = json_decode($properties, true);
foreach ($properties as $property)
{
if ('type' === $property['name'])
{
if (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']))
if (isset($property['example']) && StringHelper::check($property['example']))
{
$this->fieldTypes[$id] = $property['example'];
break;
@ -1592,7 +1618,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
// if not found
if (!isset($this->fieldTypes[$id]) && $name = ComponentbuilderHelper::getVar('fieldtype', $id, 'id', 'name'))
{
$this->fieldTypes[$id] = ComponentbuilderHelper::safeString($name);
$this->fieldTypes[$id] = StringHelper::safe($name);
}
}
// return the type
@ -1619,31 +1645,31 @@ class ComponentbuilderModelJoomla_components extends ListModel
$default = base64_decode($default);
}
// set the Template data
$temp1 = ComponentbuilderHelper::getAllBetween($default, "\$this->loadTemplate('","')");
$temp2 = ComponentbuilderHelper::getAllBetween($default, '$this->loadTemplate("','")');
$temp1 = GetHelper::allBetween($default, "\$this->loadTemplate('","')");
$temp2 = GetHelper::allBetween($default, '$this->loadTemplate("','")');
$templates = array();
$again = array();
if (ComponentbuilderHelper::checkArray($temp1) && ComponentbuilderHelper::checkArray($temp2))
if (JCBArrayHelper::check($temp1) && JCBArrayHelper::check($temp2))
{
$templates = array_merge($temp1,$temp2);
}
else
{
if (ComponentbuilderHelper::checkArray($temp1))
if (JCBArrayHelper::check($temp1))
{
$templates = $temp1;
}
elseif (ComponentbuilderHelper::checkArray($temp2))
elseif (JCBArrayHelper::check($temp2))
{
$templates = $temp2;
}
}
if (ComponentbuilderHelper::checkArray($templates))
if (JCBArrayHelper::check($templates))
{
foreach ($templates as $template)
{
$data = $this->getDataWithAlias($template, 'template');
if (ComponentbuilderHelper::checkArray($data))
if (JCBArrayHelper::check($data))
{
if (!isset($this->smartIDs['template']) || !isset($this->smartIDs['template'][$data['id']]))
{
@ -1656,29 +1682,29 @@ class ComponentbuilderModelJoomla_components extends ListModel
}
}
// set the layout data
$lay1 = ComponentbuilderHelper::getAllBetween($default, "JLayoutHelper::render('","',");
$lay2 = ComponentbuilderHelper::getAllBetween($default, 'JLayoutHelper::render("','",');
if (ComponentbuilderHelper::checkArray($lay1) && ComponentbuilderHelper::checkArray($lay2))
$lay1 = GetHelper::allBetween($default, "JLayoutHelper::render('","',");
$lay2 = GetHelper::allBetween($default, 'JLayoutHelper::render("','",');
if (JCBArrayHelper::check($lay1) && JCBArrayHelper::check($lay2))
{
$layouts = array_merge($lay1,$lay2);
}
else
{
if (ComponentbuilderHelper::checkArray($lay1))
if (JCBArrayHelper::check($lay1))
{
$layouts = $lay1;
}
elseif (ComponentbuilderHelper::checkArray($lay2))
elseif (JCBArrayHelper::check($lay2))
{
$layouts = $lay2;
}
}
if (isset($layouts) && ComponentbuilderHelper::checkArray($layouts))
if (isset($layouts) && JCBArrayHelper::check($layouts))
{
foreach ($layouts as $layout)
{
$data = $this->getDataWithAlias($layout, 'layout');
if (ComponentbuilderHelper::checkArray($data))
if (JCBArrayHelper::check($data))
{
if (!isset($this->smartIDs['layout']) || !isset($this->smartIDs['layout'][$data['id']]))
{
@ -1690,7 +1716,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
}
}
}
if (ComponentbuilderHelper::checkArray($again))
if (JCBArrayHelper::check($again))
{
foreach ($again as $get)
{
@ -1701,12 +1727,12 @@ class ComponentbuilderModelJoomla_components extends ListModel
if ($user)
{
// add templates
if (isset($this->smartIDs['template']) && ComponentbuilderHelper::checkArray($this->smartIDs['template']))
if (isset($this->smartIDs['template']) && JCBArrayHelper::check($this->smartIDs['template']))
{
$this->setData('template', array_values($this->smartIDs['template']), 'id');
}
// add layouts
if (isset($this->smartIDs['layout']) && ComponentbuilderHelper::checkArray($this->smartIDs['layout']))
if (isset($this->smartIDs['layout']) && JCBArrayHelper::check($this->smartIDs['layout']))
{
$this->setData('layout', array_values($this->smartIDs['layout']), 'id');
}
@ -1733,7 +1759,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
$rows = $this->_db->loadObjectList();
foreach ($rows as $row)
{
$k_ey = ComponentbuilderHelper::safeString($row->alias);
$k_ey = StringHelper::safe($row->alias);
$key = preg_replace("/[^A-Za-z]/", '', $k_ey);
$name = preg_replace("/[^A-Za-z]/", '', $n_ame);
if ($k_ey == $n_ame || $key == $name)
@ -1794,8 +1820,8 @@ class ComponentbuilderModelJoomla_components extends ListModel
if ('custom_code' === $type)
{
// search the value to see if it has custom code
$codeArray = ComponentbuilderHelper::getAllBetween($value, '[CUSTOMC' . 'ODE=',']');
if (ComponentbuilderHelper::checkArray($codeArray))
$codeArray = GetHelper::allBetween($value, '[CUSTOMC' . 'ODE=',']');
if (JCBArrayHelper::check($codeArray))
{
foreach ($codeArray as $func)
{
@ -1813,7 +1839,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
{
$this->setSmartIDs($func, $type);
}
elseif (ComponentbuilderHelper::checkString($func))
elseif (StringHelper::check($func))
{
if (($funcID = ComponentbuilderHelper::getVar($type, $func, 'function_name', 'id')) !== false && is_numeric($funcID))
{
@ -1831,12 +1857,12 @@ class ComponentbuilderModelJoomla_components extends ListModel
elseif ('placeholder' === $type)
{
// check if we already have the placeholder search array
if (!componentbuilderHelper::checkArray($this->placeholderM) && !componentbuilderHelper::checkArray($this->placeholderS))
if (!JCBArrayHelper::check($this->placeholderM) && !JCBArrayHelper::check($this->placeholderS))
{
$this->placeholderS = ComponentbuilderHelper::getVars($type, 1, 'published', 'target');
}
// only continue search if placeholders found
if (componentbuilderHelper::checkArray($this->placeholderS))
if (JCBArrayHelper::check($this->placeholderS))
{
foreach ($this->placeholderS as $remove => $placeholder)
{
@ -1899,7 +1925,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
{
$items = $this->_db->loadObjectList();
// check if we have items
if (ComponentbuilderHelper::checkArray($items))
if (JCBArrayHelper::check($items))
{
if (!isset($this->smartBox['language_translation']))
{
@ -1907,7 +1933,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
}
foreach ($items as $item)
{
if (!isset($this->smartBox['language_translation'][$item->id]) && ComponentbuilderHelper::checkJson($item->{$target}))
if (!isset($this->smartBox['language_translation'][$item->id]) && JsonHelper::check($item->{$target}))
{
$targets = json_decode($item->{$target}, true);
if (in_array($id, $targets))
@ -1940,11 +1966,11 @@ class ComponentbuilderModelJoomla_components extends ListModel
{
if (isset($item->system_name))
{
return ComponentbuilderHelper::safeString($item->system_name, 'cAmel');
return StringHelper::safe($item->system_name, 'cAmel');
}
else
{
return ComponentbuilderHelper::safeString($item->name_code);
return StringHelper::safe($item->name_code);
}
}
}
@ -2747,7 +2773,7 @@ class ComponentbuilderModelJoomla_components extends ListModel
$db = JFactory::getDbo();
// get the columns
$columns = $db->getTableColumns("#__componentbuilder_joomla_component");
if (ComponentbuilderHelper::checkArray($columns))
if (JCBArrayHelper::check($columns))
{
// remove the headers you don't import/export.
unset($columns['asset_id']);

View File

@ -14,6 +14,8 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
/**
* Language_translations List Model
@ -55,7 +57,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
// Create the "extension" filter
$form->setField(new SimpleXMLElement(
ComponentbuilderHelper::getExtensionGroupedListXml()
JCBFilterHelper::extensions()
),'filter');
$form->setValue(
'extension',
@ -75,7 +77,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND') . ' -'
);
// check if we have languages set
if (($languages = ComponentbuilderHelper::getAvailableLanguages()) !== false)
if (($languages = JCBFilterHelper::languages()) !== null)
{
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_TRANSLATED_IN') . ' -',
@ -85,7 +87,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
$options = array_merge($options, $languages);
}
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
$form->setValue(
'translated',
'filter',
@ -114,7 +116,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
$options = array_merge($options, $languages);
}
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
$form->setValue(
'not_translated',
'filter',
@ -300,7 +302,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
$filter_translated = $this->state->get("filter.translated");
if ($filter_translated !== null && !empty($filter_translated))
{
if (($ids = ComponentbuilderHelper::getTranslationIds($filter_translated)) !== false)
if (($ids = JCBFilterHelper::translations($filter_translated)) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
@ -315,7 +317,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
$filter_not_translated = $this->state->get("filter.not_translated");
if ($filter_not_translated !== null && !empty($filter_not_translated))
{
if (($ids = ComponentbuilderHelper::getTranslationIds($filter_not_translated, false)) !== false)
if (($ids = JCBFilterHelper::translations($filter_not_translated, false)) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',',$ids) . ')');
}
@ -332,7 +334,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
{
// column name, and id
$type_extension = explode('__', $filter_extension);
if (($ids = ComponentbuilderHelper::getTranslationExtensionsIds($type_extension[1], $type_extension[0])) !== false)
if (($ids = JCBFilterHelper::translation((int) $type_extension[1], $type_extension[0])) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
@ -459,7 +461,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
$filter_translated = $this->state->get("filter.translated");
if ($filter_translated !== null && !empty($filter_translated))
{
if (($ids = ComponentbuilderHelper::getTranslationIds($filter_translated)) !== false)
if (($ids = JCBFilterHelper::translations($filter_translated)) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
@ -474,7 +476,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
$filter_not_translated = $this->state->get("filter.not_translated");
if ($filter_not_translated !== null && !empty($filter_not_translated))
{
if (($ids = ComponentbuilderHelper::getTranslationIds($filter_not_translated, false)) !== false)
if (($ids = JCBFilterHelper::translations($filter_not_translated, false)) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',',$ids) . ')');
}
@ -491,7 +493,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
{
// column name, and id
$type_extension = explode('__', $filter_extension);
if (($ids = ComponentbuilderHelper::getTranslationExtensionsIds($type_extension[1], $type_extension[0])) !== false)
if (($ids = JCBFilterHelper::translation((int) $type_extension[1], $type_extension[0])) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}

View File

@ -16,6 +16,9 @@ use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\GetHelper;
/**
* Componentbuilder Power Admin Model
@ -65,6 +68,15 @@ class ComponentbuilderModelPower extends AdminModel
'licensing_template'
)
),
'super_power' => array(
'left' => array(
'approved',
'approved_paths'
),
'right' => array(
'note_approved_paths'
)
),
'composer' => array(
'fullwidth' => array(
'autoload_composer_note',
@ -202,6 +214,14 @@ class ComponentbuilderModelPower extends AdminModel
$item->main_class_code = base64_decode($item->main_class_code);
}
if (!empty($item->method_selection))
{
// Convert the method_selection field to an array.
$method_selection = new Registry;
$method_selection->loadString($item->method_selection);
$item->method_selection = $method_selection->toArray();
}
if (!empty($item->load_selection))
{
// Convert the load_selection field to an array.
@ -234,14 +254,6 @@ class ComponentbuilderModelPower extends AdminModel
$item->implements = $implements->toArray();
}
if (!empty($item->method_selection))
{
// Convert the method_selection field to an array.
$method_selection = new Registry;
$method_selection->loadString($item->method_selection);
$item->method_selection = $method_selection->toArray();
}
if (!empty($item->use_selection))
{
// Convert the use_selection field to an array.
@ -250,6 +262,12 @@ class ComponentbuilderModelPower extends AdminModel
$item->use_selection = $use_selection->toArray();
}
if (!empty($item->approved_paths))
{
// JSON Decode approved_paths.
$item->approved_paths = json_decode($item->approved_paths);
}
if (empty($item->id))
{
@ -1003,24 +1021,30 @@ class ComponentbuilderModelPower extends AdminModel
$data['metadata'] = (string) $metadata;
}
// Set the empty approved_paths item to data
if (!isset($data['approved_paths']))
{
$data['approved_paths'] = '';
}
// check if the name has placeholder
if (strpos($data['name'], '[[[') === false && strpos($data['name'], '###') === false)
{
// make sure the name is safe to be used as a function name
$data['name'] = ComponentbuilderHelper::safeClassFunctionName($data['name']);
$data['name'] = ClassfunctionHelper::safe($data['name']);
}
// if system name is empty create from name
if (empty($data['system_name']) || !ComponentbuilderHelper::checkString($data['system_name']))
if (empty($data['system_name']) || !UtilitiesStringHelper::check($data['system_name']))
{
$data['system_name'] = $data['name'];
}
// must set the version if empty
if (empty($data['power_version']) && $data['id'] > 0 && ($power_version = ComponentbuilderHelper::getVar('power', $data['id'], 'id', 'power_version')) !== false)
if (empty($data['power_version']) && $data['id'] > 0 && ($power_version = GetHelper::var('power', $data['id'], 'id', 'power_version')) !== false)
{
$data['power_version'] = $power_version;
}
// we must preserve versions (so that a change to the version number must result in save as copy)
elseif ($data['id'] > 0 && ($old_version = ComponentbuilderHelper::getVar('power', $data['id'], 'id', 'power_version')) && $data['power_version'] != $old_version)
elseif ($data['id'] > 0 && ($old_version = GetHelper::var('power', $data['id'], 'id', 'power_version')) && $data['power_version'] != $old_version)
{
// lets check if we already have this version
if (($existing_id = ComponentbuilderHelper::checkExist('power', ['power_version' => $data['power_version'], 'name' => $data['name'], 'namespace' => $data['namespace']])) !== false)
@ -1051,6 +1075,19 @@ class ComponentbuilderModelPower extends AdminModel
}
// Set the method_selection items to data.
if (isset($data['method_selection']) && is_array($data['method_selection']))
{
$method_selection = new JRegistry;
$method_selection->loadArray($data['method_selection']);
$data['method_selection'] = (string) $method_selection;
}
elseif (!isset($data['method_selection']))
{
// Set the empty method_selection to data
$data['method_selection'] = '';
}
// Set the load_selection items to data.
if (isset($data['load_selection']) && is_array($data['load_selection']))
{
@ -1103,19 +1140,6 @@ class ComponentbuilderModelPower extends AdminModel
$data['implements'] = '';
}
// Set the method_selection items to data.
if (isset($data['method_selection']) && is_array($data['method_selection']))
{
$method_selection = new JRegistry;
$method_selection->loadArray($data['method_selection']);
$data['method_selection'] = (string) $method_selection;
}
elseif (!isset($data['method_selection']))
{
// Set the empty method_selection to data
$data['method_selection'] = '';
}
// Set the use_selection items to data.
if (isset($data['use_selection']) && is_array($data['use_selection']))
{
@ -1129,6 +1153,12 @@ class ComponentbuilderModelPower extends AdminModel
$data['use_selection'] = '';
}
// Set the approved_paths string to JSON string.
if (isset($data['approved_paths']))
{
$data['approved_paths'] = (string) json_encode($data['approved_paths']);
}
// Set the licensing_template string to base64 string.
if (isset($data['licensing_template']))
{

View File

@ -14,6 +14,9 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\Component\Helper as JCBHelper;
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
/**
* Powers List Model
@ -32,16 +35,123 @@ class ComponentbuilderModelPowers extends ListModel
'a.created_by','created_by',
'a.modified_by','modified_by',
'a.type','type',
'a.power_version','power_version',
'h.name','extends',
'a.approved','approved',
'a.system_name','system_name',
'a.namespace','namespace'
'a.namespace','namespace',
'a.power_version','power_version'
);
}
parent::__construct($config);
}
/**
* Get the filter form - Override the parent method
*
* @param array $data data
* @param boolean $loadData load current data
*
* @return \JForm|boolean The \JForm object or false on error
*
* @since JCB 2.12.5
*/
public function getFilterForm($data = array(), $loadData = true)
{
// load form from the parent class
$form = parent::getFilterForm($data, $loadData);
// Create the "admin_view" filter
$attributes = array(
'name' => 'namegroup',
'type' => 'list',
'onchange' => 'this.form.submit();',
);
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_NAMESPACE_FOUND') . ' -'
);
// check if we have namespace (and limit to an extension if it is set)
if (($namespaces = JCBFilterHelper::namespaces()) !== null)
{
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_A_NAMESPACE') . ' -'
);
// make sure we do not lose the key values in normal merge
$options = $options + $namespaces;
}
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
$form->setValue(
'namegroup',
'filter',
$this->state->get("filter.namegroup")
);
array_push($this->filter_fields, 'namegroup');
// get the component params
$params = JCBHelper::getParams();
$activate = $params->get('super_powers_repositories', 0);
if ($activate == 1)
{
$subform = $params->get('approved_paths', null);
// create approved paths filter
$attributes = array(
'name' => 'approved_paths',
'type' => 'list',
'onchange' => 'this.form.submit();',
);
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_PATHS_FOUND') . ' -'
);
// add the paths found in global settings
if (is_object($subform))
{
$core = $params->get('super_powers_core', 'joomla/super-powers');
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_APPROVED_PATH') . ' -',
$core => $core
);
foreach ($subform as $value)
{
if (isset($value->owner) && strlen($value->owner) > 1 &&
isset($value->repo) && strlen($value->repo) > 1)
{
$value = trim($value->owner) . '/' . trim($value->repo);
$options[$value] = $value;
}
}
}
$form->setField(JCBFormHelper::xml($attributes, $options), 'filter');
$form->setValue(
'approved_paths',
'filter',
$this->state->get("filter.approved_paths")
);
array_push($this->filter_fields, 'approved_paths');
}
return $form;
}
/**
* Check if a power can be used in linking
*
* @param string $type the type of power
*
* @return bool
* @since JCB 3.1.23
*/
protected function isSuperPower(string $type): bool
{
return in_array($type, ['class', 'abstract class', 'final class', 'trait']);
}
/**
* Method to auto-populate the model state.
*
@ -95,18 +205,11 @@ class ComponentbuilderModelPowers extends ListModel
$this->setState('filter.type', $type);
}
$power_version = $this->getUserStateFromRequest($this->context . '.filter.power_version', 'filter_power_version');
$approved = $this->getUserStateFromRequest($this->context . '.filter.approved', 'filter_approved');
if ($formSubmited)
{
$power_version = $app->input->post->get('power_version');
$this->setState('filter.power_version', $power_version);
}
$extends = $this->getUserStateFromRequest($this->context . '.filter.extends', 'filter_extends');
if ($formSubmited)
{
$extends = $app->input->post->get('extends');
$this->setState('filter.extends', $extends);
$approved = $app->input->post->get('approved');
$this->setState('filter.approved', $approved);
}
$system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name');
@ -123,6 +226,13 @@ class ComponentbuilderModelPowers extends ListModel
$this->setState('filter.namespace', $namespace);
}
$power_version = $this->getUserStateFromRequest($this->context . '.filter.power_version', 'filter_power_version');
if ($formSubmited)
{
$power_version = $app->input->post->get('power_version');
$this->setState('filter.power_version', $power_version);
}
// List state information.
parent::populateState($ordering, $direction);
}
@ -158,6 +268,11 @@ class ComponentbuilderModelPowers extends ListModel
continue;
}
// create the GUID placeholder key
if ($this->isSuperPower($item->type))
{
$item->super_power_key = 'Super_'.'_'.'_' . str_replace('-', '_', $item->guid) . '_'.'_'.'_Power';
}
// remove dots
$item->namespace = str_replace('.','\\', $item->namespace);
}
@ -170,6 +285,8 @@ class ComponentbuilderModelPowers extends ListModel
{
// convert type
$item->type = $this->selectionTranslation($item->type, 'type');
// convert approved
$item->approved = $this->selectionTranslation($item->approved, 'approved');
}
}
@ -201,6 +318,19 @@ class ComponentbuilderModelPowers extends ListModel
return $typeArray[$value];
}
}
// Array of approved language strings
if ($name === 'approved')
{
$approvedArray = array(
0 => 'COM_COMPONENTBUILDER_POWER_NOT_APPROVED',
1 => 'COM_COMPONENTBUILDER_POWER_APPROVED'
);
// Now check if value is found in this array
if (isset($approvedArray[$value]) && ComponentbuilderHelper::checkString($approvedArray[$value]))
{
return $approvedArray[$value];
}
}
return $value;
}
@ -223,9 +353,43 @@ class ComponentbuilderModelPowers extends ListModel
// From the componentbuilder_item table
$query->from($db->quoteName('#__componentbuilder_power', 'a'));
// do not use these filters in the export method
if (!isset($_export) || !$_export)
{
// Filtering "namegroup"
$filter_namegroup = $this->state->get("filter.namegroup");
if ($filter_namegroup !== null && !empty($filter_namegroup))
{
if (($ids = JCBFilterHelper::namegroup($filter_namegroup)) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
else
{
// there is none
$query->where($db->quoteName('a.id') . ' = ' . 0);
}
}
// Filtering "approved paths"
$filter_approved_paths = $this->state->get("filter.approved_paths");
if ($filter_approved_paths !== null && !empty($filter_approved_paths))
{
if (($ids = JCBFilterHelper::paths($filter_approved_paths)) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
else
{
// there is none
$query->where($db->quoteName('a.id') . ' = ' . 0);
}
}
}
// From the componentbuilder_power table.
$query->select($db->quoteName(['h.name','h.id'],['extends_name','extends_id']));
$query->join('LEFT', $db->quoteName('#__componentbuilder_power', 'h') . ' ON (' . $db->quoteName('a.extends') . ' = ' . $db->quoteName('h.guid') . ')');
$query->select($db->quoteName(['g.name','g.id'],['extends_name','extends_id']));
$query->join('LEFT', $db->quoteName('#__componentbuilder_power', 'g') . ' ON (' . $db->quoteName('a.extends') . ' = ' . $db->quoteName('g.guid') . ')');
// Filter by published state
$published = $this->getState('filter.published');
@ -271,7 +435,7 @@ class ComponentbuilderModelPowers extends ListModel
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
$query->where('(a.system_name LIKE '.$search.' OR a.type LIKE '.$search.' OR a.description LIKE '.$search.' OR a.extends_custom LIKE '.$search.' OR a.extends LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.name LIKE '.$search.')');
$query->where('(a.system_name LIKE '.$search.' OR a.type LIKE '.$search.' OR a.description LIKE '.$search.' OR a.extends LIKE '.$search.' OR a.extends_custom LIKE '.$search.' OR a.approved_paths LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.name LIKE '.$search.')');
}
}
@ -315,39 +479,22 @@ class ComponentbuilderModelPowers extends ListModel
// Filter by the Type Array.
$query->where('a.type IN (' . implode(',', $_type) . ')');
}
// Filter by Power_version.
$_power_version = $this->getState('filter.power_version');
if (is_numeric($_power_version))
// Filter by Approved.
$_approved = $this->getState('filter.approved');
if (is_numeric($_approved))
{
if (is_float($_power_version))
if (is_float($_approved))
{
$query->where('a.power_version = ' . (float) $_power_version);
$query->where('a.approved = ' . (float) $_approved);
}
else
{
$query->where('a.power_version = ' . (int) $_power_version);
$query->where('a.approved = ' . (int) $_approved);
}
}
elseif (ComponentbuilderHelper::checkString($_power_version))
elseif (ComponentbuilderHelper::checkString($_approved))
{
$query->where('a.power_version = ' . $db->quote($db->escape($_power_version)));
}
// Filter by Extends.
$_extends = $this->getState('filter.extends');
if (is_numeric($_extends))
{
if (is_float($_extends))
{
$query->where('a.extends = ' . (float) $_extends);
}
else
{
$query->where('a.extends = ' . (int) $_extends);
}
}
elseif (ComponentbuilderHelper::checkString($_extends))
{
$query->where('a.extends = ' . $db->quote($db->escape($_extends)));
$query->where('a.approved = ' . $db->quote($db->escape($_approved)));
}
// Add the list ordering clause.
@ -400,10 +547,10 @@ class ComponentbuilderModelPowers extends ListModel
{
$id .= ':' . $_type;
}
$id .= ':' . $this->getState('filter.power_version');
$id .= ':' . $this->getState('filter.extends');
$id .= ':' . $this->getState('filter.approved');
$id .= ':' . $this->getState('filter.system_name');
$id .= ':' . $this->getState('filter.namespace');
$id .= ':' . $this->getState('filter.power_version');
return parent::getStoreId($id);
}

View File

@ -14,6 +14,8 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
/**
* Site_views List Model
@ -69,7 +71,7 @@ class ComponentbuilderModelSite_views extends ListModel
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -'
);
// check if we have joomla components
if (($joomla_components = ComponentbuilderHelper::getByTypeTheIdsSystemNames('joomla_component')) !== false)
if (($joomla_components = JCBFilterHelper::names('joomla_component')) !== null)
{
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -'
@ -78,7 +80,7 @@ class ComponentbuilderModelSite_views extends ListModel
$options = $options + $joomla_components;
}
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
$form->setValue(
'joomla_component',
'filter',
@ -301,7 +303,7 @@ class ComponentbuilderModelSite_views extends ListModel
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_site_views')) !== false)
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_site_views')) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
@ -506,7 +508,7 @@ class ComponentbuilderModelSite_views extends ListModel
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_site_views')) !== false)
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_site_views')) !== null)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,2 @@
ALTER TABLE `#__componentbuilder_power` ADD `approved` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_licensing_template`;
ALTER TABLE `#__componentbuilder_power` ADD `approved_paths` TEXT NOT NULL AFTER `approved`;

View File

@ -11,6 +11,7 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use VDM\Joomla\Utilities\StringHelper;
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.formvalidator');
@ -125,7 +126,7 @@ jQuery('<div id="compiling"></div>')
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php if (ComponentbuilderHelper::checkString($this->SuccessMessage)): ?>
<?php if (StringHelper::check($this->SuccessMessage)): ?>
<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<?php echo $this->SuccessMessage; ?>
@ -139,13 +140,8 @@ jQuery('<div id="compiling"></div>')
<div id="compilerForm">
<div>
<span class="notice" style="display:none; color:red;"><?php echo JText::_('COM_COMPONENTBUILDER_YOU_MUST_SELECT_A_COMPONENT'); ?></span><br />
<?php if ($this->Form): ?>
<?php foreach ($this->Form as $field): ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label; ?></div>
<div class="controls"><?php echo $field->input; ?></div>
</div>
<?php endforeach; ?>
<?php if ($this->form): ?>
<?php echo $this->form->renderFieldset('builder'); ?>
<?php endif; ?>
</div>
<br />
@ -158,6 +154,7 @@ jQuery('<div id="compiling"></div>')
</div>
</div>
<div class="span7">
<div id="advance-details"><?php echo $this->form->renderFieldset('advanced'); ?></div>
<div id="component-details"><?php echo $selectNotice; ?></div>
<?php echo JLayoutHelper::render('jcbnoticeboardtabs', array('id' => 'noticeboard' , 'active' => $noticeboardOptions[array_rand($noticeboardOptions)])); ?>
</div>

View File

@ -14,6 +14,7 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Form\Form;
/**
* Componentbuilder Html View class for the Compiler
@ -47,7 +48,7 @@ class ComponentbuilderViewCompiler extends HtmlView
$this->Components = $this->get('Components');
// get the needed form fields
$this->Form = $this->getDynamicForm();
$this->form = $this->getDynamicForm();
// set the compiler artwork from global settings
$this->builder_gif_size = $this->params->get('builder_gif_size', '480-272');
@ -106,119 +107,417 @@ class ComponentbuilderViewCompiler extends HtmlView
/**
* Get the dynamic build form fields needed on the page
*
* @return array|null The array of form fields
* @return Form|null The form fields
*
* @since 3.2.0
*/
public function getDynamicForm(): ?array
public function getDynamicForm(): ?Form
{
if(ComponentbuilderHelper::checkArray($this->Components))
{
// start the form
$form = array();
$form = new Form('Builder');
$form->load('<form
addrulepath="/administrator/components/com_componentbuilder/models/rules"
addfieldpath="/administrator/components/com_componentbuilder/models/fields">
<fieldset name="builder"></fieldset>
<fieldset name="advanced"></fieldset>
</form>');
// sales attributes
$attributes = array(
$attributes = [
'type' => 'radio',
'name' => 'backup',
'label' => 'COM_COMPONENTBUILDER_ADD_TO_BACKUP_FOLDER_AMP_SALES_SERVER_SMALLIF_SETSMALL',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_ZIPPED_PACKAGE_OF_THE_COMPONENT_BE_MOVED_TO_THE_LOCAL_BACKUP_AND_REMOTE_SALES_SERVER_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_THOSE_VALUES_SET',
'default' => '0');
'default' => '0'];
// set the sales options
$options = array(
$options = [
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO');
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$form[] = ComponentbuilderHelper::getFieldObject($attributes, 0, $options);
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// repository attributes
$attributes = array(
$attributes = [
'type' => 'radio',
'name' => 'repository',
'label' => 'COM_COMPONENTBUILDER_ADD_TO_REPOSITORY_FOLDER',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_COMPONENT_BE_MOVED_TO_YOUR_LOCAL_REPOSITORY_FOLDER',
'default' => '1');
'default' => '1'];
// start the repository options
$options = array(
$options = [
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO');
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$form[] = ComponentbuilderHelper::getFieldObject($attributes, 1, $options);
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// placeholders attributes
$attributes = array(
$attributes = [
'type' => 'radio',
'name' => 'add_placeholders',
'label' => 'COM_COMPONENTBUILDER_ADD_CUSTOM_CODE_PLACEHOLDERS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_JCB_INSERT_THE_CUSTOM_CODE_PLACEHOLDERS_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_CUSTOM_CODE',
'default' => '2');
'default' => '2'];
// start the placeholders options
$options = array(
$options = [
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO');
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$form[] = ComponentbuilderHelper::getFieldObject($attributes, 2, $options);
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// debuglinenr attributes
$attributes = array(
$attributes = [
'type' => 'radio',
'name' => 'debug_line_nr',
'label' => 'COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_ADD_CORRESPONDING_LINE_NUMBERS_TO_THE_DYNAMIC_COMMENTS_SO_TO_SEE_WHERE_IN_THE_COMPILER_THE_LINES_OF_CODE_WAS_BUILD_THIS_WILL_HELP_IF_YOU_NEED_TO_GET_MORE_TECHNICAL_WITH_AN_ISSUE_ON_GITHUB_OR_EVEN_FOR_YOUR_OWN_DEBUGGING',
'default' => '2');
$options = array(
'default' => '2'];
$options = [
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO');
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$form[] = ComponentbuilderHelper::getFieldObject($attributes, 2, $options);
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// minify attributes
$attributes = array(
$attributes = [
'type' => 'radio',
'name' => 'minify',
'label' => 'COM_COMPONENTBUILDER_MINIFY_JAVASCRIPT',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_JAVASCRIPT_BE_MINIFIED_IN_THE_COMPONENT',
'default' => '2');
$options = array(
'default' => '2'];
$options = [
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO');
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$form[] = ComponentbuilderHelper::getFieldObject($attributes, 2, $options);
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// powers attributes
$attributes = array(
$attributes = [
'type' => 'radio',
'name' => 'powers',
'label' => 'COM_COMPONENTBUILDER_ADD_POWERS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_JCB_ADD_ANY_POWERS_THAT_ARE_CONNECTED_TO_THIS_COMPONENT_THIS_MAY_BE_HELPFUL_IF_YOU_ARE_LOADING_POWERS_VIA_ANOTHER_COMPONENT_AND_WOULD_LIKE_TO_AVOID_ADDING_IT_TO_BOTH_JUST_REMEMBER_THAT_IN_THIS_CASE_YOU_NEED_TO_LOAD_THE_POWERS_VIA_A_PLUGIN',
'default' => '2');
$options = array(
'default' => '2'];
$options = [
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO');
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$form[] = ComponentbuilderHelper::getFieldObject($attributes, 2, $options);
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// component attributes
$attributes = array(
$attributes = [
'type' => 'list',
'name' => 'component_id',
'label' => 'COM_COMPONENTBUILDER_COMPONENTS',
'class' => 'list_class',
'description' => 'COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_COMPILE',
'required' => 'true');
'required' => 'true'];
// start the component options
$options = array();
$options = [];
$options[''] = 'COM_COMPONENTBUILDER__SELECT_COMPONENT_';
// load component options from array
foreach($this->Components as $component)
{
$options[(int) $component->id] = $this->escape($component->name);
}
// add to form
$form[] = ComponentbuilderHelper::getFieldObject($attributes, '', $options);
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// Advanced Options
$attributes = [
'type' => 'radio',
'name' => 'show_advanced_options',
'label' => 'COM_COMPONENTBUILDER_SHOW_ADVANCED_OPTIONS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_SEE_THE_ADVANCED_COMPILER_OPTIONS',
'default' => '0'];
// start the advanced options switch
$options = [
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// Advanced Options note attributes
$attributes = [
'type' => 'note',
'name' => 'show_advanced_options_note',
'label' => "COM_COMPONENTBUILDER_ADVANCED_OPTIONS",
'heading' => 'h3',
'showon' => 'show_advanced_options:1'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Joomla Versions attributes
$attributes = [
'type' => 'radio',
'name' => 'joomla_version_donations',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_VERSION',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_WHAT_VERSION_OF_JOOMLA_WOULD_YOU_LIKE_TO_TARGET',
'default' => '3',
'showon' => 'show_advanced_options:1'];
// start the joomla versions options
$options = [
'3' => 'COM_COMPONENTBUILDER_JOOMLA_THREE',
'4' => 'COM_COMPONENTBUILDER_JOOMLA_FOUR'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Joomla Version 3 attributes
$attributes = [
'type' => 'note',
'name' => 'joomla_version_note_three',
'description' => 'COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_THREE',
'class' => 'alert alert-success',
'showon' => 'show_advanced_options:1[AND]joomla_version_donations:3'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Joomla Version 4 attributes
$attributes = [
'type' => 'note',
'name' => 'joomla_version_note_four',
'description' => 'COM_COMPONENTBUILDER_JCB_IS_NOT_YET_FULLY_READY_FOR_JOOMLA_FOUR_BUT_WITH_YOUR_HELP_WE_CAN_MAKE_THE_TRANSITION_FASTER_SHOW_YOUR_SUPPORT_BY_MAKING_A_DONATION_TODAY_AND_HELP_US_BRING_JCB_TO_THE_NEXT_LEVELBR_BR_BYOUR_COMPONENT_WILL_STILL_ONLY_BE_COMPILED_FOR_JOOMLA_THREEB',
'class' => 'alert alert-info',
'showon' => 'show_advanced_options:1[AND]joomla_version_donations:4'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// powers repository attributes
$attributes = [
'type' => 'radio',
'name' => 'powers_repository',
'label' => 'COM_COMPONENTBUILDER_ACTIVATE_SUPER_POWERS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_THIS_ADDS_POWERS_TO_A_LOCAL_REPOSITORY_FOLDER_ALL_BAPPROVEDB_POWERS_LINKED_TO_THIS_COMPONENT_WILL_BE_MOVED_TO_YOUR_BLOCALB_POWERS_REPOSITORY_FOLDER_INTO_THEIR_SELECTIVE_TARGET_PATHS_THIS_LOCAL_FOLDER_PATH_MUST_BE_SET_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_BSUPER_POWERB_TAB',
'default' => '2',
'showon' => 'show_advanced_options:1'];
// start the repository options
$options = [
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// powers local path to repositories attributes
$attributes = [
'type' => 'text',
'name' => 'local_powers_repository_path',
'label' => 'COM_COMPONENTBUILDER_LOCAL_POWERS_REPOSITORY_PATH',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_HERE_YOU_CAN_SET_THE_PATH_TO_THE_SUPER_POWERS_LOCAL_REPOSITORY_FOLDER_WHERE_BLAYERCOREB_AND_ALL_TARGETED_BLAYEROWNB_SUB_PATHS_WILL_BE_PLACED_WITH_THEIR_SELECTIVE_BSWITCHAPPROVEDB_POWERS',
'default' => $this->params->get('local_powers_repository_path', ''),
'showon' => 'show_advanced_options:1[AND]powers_repository:1'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Indentation attributes
$attributes = [
'type' => 'radio',
'name' => 'indentation_value',
'label' => 'COM_COMPONENTBUILDER_INDENTATION_OPTIONS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_WHICH_TYPE_OF_INDENTATION_WOULD_YOU_LIKE_TO_USE_PLEASE_NOTE_THAT_THIS_DOES_NOT_YET_IMPACT_THE_STATIC_TEMPLATES',
'default' => '1',
'showon' => 'show_advanced_options:1'];
// start the indentation options
$options = [
'1' => 'COM_COMPONENTBUILDER_TAB',
'2' => 'COM_COMPONENTBUILDER_TWO_SPACES',
'4' => 'COM_COMPONENTBUILDER_FOUR_SPACES'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date attributes
$attributes = [
'type' => 'radio',
'name' => 'add_build_date',
'label' => 'COM_COMPONENTBUILDER_BUILD_DATE',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_OVERRIDE_THE_BUILD_DATE',
'default' => '1',
'showon' => 'show_advanced_options:1'];
// start the build date options
$options = [
'1' => 'COM_COMPONENTBUILDER_DEFAULT',
'2' => 'COM_COMPONENTBUILDER_MANUAL',
'3' => 'COM_COMPONENTBUILDER_COMPONENT'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date note attributes
$attributes = [
'type' => 'note',
'name' => 'add_build_date_note_two',
'description' => 'COM_COMPONENTBUILDER_ALLOWS_YOU_TO_OVERRIDE_THE_BUILD_DATE_BY_SELECTING_A_DATE_MANUALLY_FROM_THE_CALENDER',
'class' => 'alert alert-info',
'showon' => 'show_advanced_options:1[AND]add_build_date:2'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date note attributes
$attributes = [
'type' => 'note',
'name' => 'add_build_date_note_three',
'description' => "COM_COMPONENTBUILDER_THE_COMPONENTS_LAST_MODIFIED_DATE_WILL_BE_USED",
'class' => 'alert alert-info',
'showon' => 'show_advanced_options:1[AND]add_build_date:3'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date calendar attributes
$attributes = [
'type' => 'calendar',
'name' => 'build_date',
'label' => 'COM_COMPONENTBUILDER_SELECT_BUILD_DATE',
'format' => '%Y-%m-%d',
'filter' => 'user_utc',
'default' => 'now',
'size' => '22',
'showon' => 'show_advanced_options:1[AND]add_build_date:2'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date note attributes
$attributes = [
'type' => 'note',
'name' => 'donations_note',
'label' => "COM_COMPONENTBUILDER_DONATIONS",
'description' => $this->getSupportMessage(),
'class' => 'alert alert-success',
'heading' => 'h1',
'showon' => 'show_advanced_options:1'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date note line attributes
$attributes = [
'type' => 'note',
'name' => 'donations_note_line',
'description' => '<hr />',
'showon' => 'show_advanced_options:1'];
// add to form
$xml = ComponentbuilderHelper::getFieldXML($attributes);
if ($xml instanceof SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// return the form array
return $form;
@ -226,6 +525,18 @@ class ComponentbuilderViewCompiler extends HtmlView
return null;
}
/**
* Get the dynamic support request/gratitude message
*
* @return string The support message
*
* @since 3.2.0
*/
protected function getSupportMessage(): string
{
return JLayoutHelper::render('jcbsupportmessage', []);
}
/**

View File

@ -213,14 +213,14 @@ jQuery('<div id="loading"></div>')
</div>
<?php if ($hasOwner): ?>
<div class="well span6">
<?php echo ComponentbuilderHelper::getPackageOwnerDetailsDisplay($this->packageInfo); ?>
<?php echo \VDM\Joomla\Componentbuilder\Package\Factory::_('Display.Details')->owner($this->packageInfo); ?>
</div>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php if (isset($this->packageInfo['name']) && ComponentbuilderHelper::checkArray($this->packageInfo['name'])) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'jcbImportTab', 'info', JText::sprintf('COM_COMPONENTBUILDER_S_BEING_IMPORTED', $comP)); ?>
<?php echo ComponentbuilderHelper::getPackageComponentsDetailsDisplay($this->packageInfo); ?>
<?php echo \VDM\Joomla\Componentbuilder\Package\Factory::_('Display.Details')->components($this->packageInfo); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>

View File

@ -64,6 +64,17 @@ $componentParams = $this->params; // will be removed just use $this->params inst
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'powerTab', 'super_power', JText::_('COM_COMPONENTBUILDER_POWER_SUPER_POWER', true)); ?>
<div class="row-fluid form-horizontal-desktop">
<div class="span6">
<?php echo JLayoutHelper::render('power.super_power_left', $this); ?>
</div>
<div class="span6">
<?php echo JLayoutHelper::render('power.super_power_right', $this); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'powerTab', 'composer', JText::_('COM_COMPONENTBUILDER_POWER_COMPOSER', true)); ?>
<div class="row-fluid form-horizontal-desktop">
</div>

View File

@ -146,6 +146,16 @@ class ComponentbuilderViewPower extends HtmlView
{
JToolBarHelper::custom('power.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
if ($this->canDo->get('power.sync'))
{
// add Sync button.
JToolBarHelper::custom('power.syncPowers', 'loop custom-button-syncpowers', '', 'COM_COMPONENTBUILDER_SYNC', false);
}
if ($this->canDo->get('power.reset'))
{
// add Reset button.
JToolBarHelper::custom('power.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
}
JToolBarHelper::cancel('power.cancel', 'JTOOLBAR_CLOSE');
}
}

View File

@ -67,7 +67,7 @@ $edit = "index.php?option=com_componentbuilder&view=powers&task=power.edit";
<?php else: ?>
<?php echo $this->escape($item->system_name); ?>
<?php endif; ?><br /><small>GUID:
<?php echo $this->escape($item->guid); ?></small>
<?php echo $this->escape($item->guid); ?><?php if(isset($item->super_power_key)): ?><br />SPK: <?php echo $item->super_power_key; ?><?php endif; ?></small>
</div>
</td>
<td class="hidden-phone">
@ -81,7 +81,8 @@ $edit = "index.php?option=com_componentbuilder&view=powers&task=power.edit";
<?php else: ?>
<?php echo $this->escape($item->extends_name); ?>
<?php endif; ?><?php elseif ($item->extends === '-1') : ?><br /><?php echo JText::_('COM_COMPONENTBUILDER_EXTENDS'); ?>:
<?php echo $this->escape($item->extends_custom); ?><?php endif; ?>
<?php echo $this->escape($item->extends_custom); ?><?php endif; ?><br /><?php echo JText::_('COM_COMPONENTBUILDER_SUPER_POWER'); ?>:
<?php echo JText::_($item->approved); ?>
</div>
</td>
<td class="hidden-phone">

View File

@ -141,6 +141,21 @@ class ComponentbuilderViewPowers extends HtmlView
// add Run Expansion button.
JToolBarHelper::custom('powers.runExpansion', 'expand-2 custom-button-runexpansion', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false);
}
if ($this->user->authorise('power.init', 'com_componentbuilder'))
{
// add Init button.
JToolBarHelper::custom('powers.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
}
if ($this->user->authorise('power.sync', 'com_componentbuilder'))
{
// add Sync button.
JToolBarHelper::custom('powers.syncPowers', 'loop custom-button-syncpowers', '', 'COM_COMPONENTBUILDER_SYNC', false);
}
if ($this->user->authorise('power.reset', 'com_componentbuilder'))
{
// add Reset button.
JToolBarHelper::custom('powers.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('powers');
@ -195,43 +210,23 @@ class ComponentbuilderViewPowers extends HtmlView
);
}
// Only load Power Version batch if create, edit, and batch is allowed
// Only load Approved batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set Power Version Selection
$this->power_versionOptions = JFormHelper::loadFieldType('powersfilterpowerversion')->options;
// We do some sanitation for Power Version filter
if (ComponentbuilderHelper::checkArray($this->power_versionOptions) &&
isset($this->power_versionOptions[0]->value) &&
!ComponentbuilderHelper::checkString($this->power_versionOptions[0]->value))
// Set Approved Selection
$this->approvedOptions = JFormHelper::loadFieldType('powersfilterapproved')->options;
// We do some sanitation for Approved filter
if (ComponentbuilderHelper::checkArray($this->approvedOptions) &&
isset($this->approvedOptions[0]->value) &&
!ComponentbuilderHelper::checkString($this->approvedOptions[0]->value))
{
unset($this->power_versionOptions[0]);
unset($this->approvedOptions[0]);
}
// Power Version Batch Selection
// Approved Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_COMPONENTBUILDER_POWER_POWER_VERSION_LABEL').' -',
'batch[power_version]',
JHtml::_('select.options', $this->power_versionOptions, 'value', 'text')
);
}
// Only load Extends Name batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set Extends Name Selection
$this->extendsNameOptions = JFormHelper::loadFieldType('Classpowers')->options;
// We do some sanitation for Extends Name filter
if (ComponentbuilderHelper::checkArray($this->extendsNameOptions) &&
isset($this->extendsNameOptions[0]->value) &&
!ComponentbuilderHelper::checkString($this->extendsNameOptions[0]->value))
{
unset($this->extendsNameOptions[0]);
}
// Extends Name Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_COMPONENTBUILDER_POWER_EXTENDS_LABEL').' -',
'batch[extends]',
JHtml::_('select.options', $this->extendsNameOptions, 'value', 'text')
'- Keep Original '.JText::_('COM_COMPONENTBUILDER_POWER_APPROVED_LABEL').' -',
'batch[approved]',
JHtml::_('select.options', $this->approvedOptions, 'value', 'text')
);
}
}

View File

@ -14,8 +14,8 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Form\Form;
use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
use Joomla\CMS\Form\Form;
/**
* Componentbuilder Html View class for the Search

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>29th January, 2023</creationDate>
<creationDate>2nd May, 2023</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>3.1.13</version>
<version>3.1.24</version>
<description><![CDATA[
<h1>Component Builder (v.3.1.13)</h1>
<h1>Component Builder (v.3.1.24)</h1>
<div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!</p>
<p>Created by <a href="https://dev.vdm.io" target="_blank">Llewellyn van der Merwe</a><br /><small>Development started 30th April, 2015</small></p>
]]></description>
@ -124,4 +124,4 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo
<updateservers>
<server type="extension" enabled="1" element="com_componentbuilder" name="Component Builder">https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/componentbuilder_update_server.xml</server>
</updateservers>
</extension>
</extension>

View File

@ -1112,12 +1112,49 @@
<update>
<name>Component Builder</name>
<description>Builds Complex Joomla Components</description>
<element>com_componentbuilder</element>
<type>component</type>
<version>3.1.13</version>
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>3.1.19</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">http://domain.com/demo.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.19.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://dev.vdm.io</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
<update>
<name>Component Builder</name>
<description>Builds Complex Joomla Components</description>
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>3.1.21</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla-beta/pkg-component-builder/archive/v3.1.22.zip</downloadurl>
</downloads>
<tags>
<tag>beta</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://dev.vdm.io</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
<update>
<name>Component Builder</name>
<description>Builds Complex Joomla Components</description>
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>3.1.24</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.1.24.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>

View File

@ -1,164 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Gitea;
use Joomla\CMS\Http\Http as BaseHttp;
use Joomla\CMS\Http\HttpFactory;
use Joomla\CMS\Http\Response;
use Joomla\Registry\Registry;
use Joomla\Uri\Uri;
use VDM\Joomla\Utilities\JsonHelper;
abstract class AbstractGiteaObject
{
/**
* Options for the Gitea object.
*
* @var Registry
* @since 1.0
*/
protected $options;
/**
* The HTTP client object to use in sending HTTP requests.
*
* @var BaseHttp
* @since 1.0
*/
protected $client;
/**
* The package the object resides in
*
* @var string
* @since 1.0
*/
protected $package = '';
/**
* Constructor.
*
* @param Registry $options Gitea options object.
* @param BaseHttp $client The HTTP client object.
*
* @since 1.0
*/
public function __construct(Registry $options = null, BaseHttp $client = null)
{
$this->options = $options ?: new Registry;
$this->client = $client ?: (new HttpFactory)->getHttp($this->options);
$this->package = static::class;
$this->package = substr($this->package, strrpos($this->package, '\\') + 1);
}
/**
* Method to build and return a full request URL for the request. This method will
* add appropriate pagination details if necessary and also prepend the API url
* to have a complete URL for the request.
*
* @param string $path URL to inflect
* @param integer $page Page to request
* @param integer $limit Number of results to return per page
*
* @return Uri
*
* @since 1.0
*/
protected function fetchUrl($path, $page = 0, $limit = 0)
{
// Get a new Uri object focusing the api url and given path.
$uri = new Uri($this->options->get('api.url') . $path);
if ($this->options->get('access.token', false))
{
// Use oAuth authentication
$headers = $this->client->getOption('headers', []);
if (!isset($headers['Authorization']))
{
$headers['Authorization'] = 'token ' . $this->options->get('access.token');
$this->client->setOption('headers', $headers);
}
}
else
{
// Use basic authentication
if ($this->options->get('api.username', false))
{
$uri->setUser($this->options->get('api.username'));
}
if ($this->options->get('api.password', false))
{
$uri->setPass($this->options->get('api.password'));
}
}
// If we have a defined page number add it to the JUri object.
if ($page > 0)
{
$uri->setVar('page', (int) $page);
}
// If we have a defined items per page add it to the JUri object.
if ($limit > 0)
{
$uri->setVar('limit', (int) $limit);
}
return $uri;
}
/**
* Process the response and decode it.
*
* @param Response $response The response.
* @param integer $expectedCode The expected "good" code.
*
* @return mixed
*
* @since 1.0
* @throws RuntimeException
*/
protected function processResponse(Response $response, $expectedCode = 200)
{
// Validate the response code.
if ($response->code != $expectedCode)
{
// Decode the error response and throw an exception.
$error = json_decode((string) $response->body);
$message = isset($error->message) ? $error->message : 'Invalid response received from Gitea.';
throw new \DomainException($message, $response->code);
}
if (JsonHelper::check($response->body))
{
$body = json_decode((string) $response->body);
if (isset($body->content_base64))
{
$body->content = base64_decode((string) $body->content_base64);
}
}
else
{
$body = $response->body;
}
return $body;
}
}

View File

@ -1,70 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Gitea;
use Joomla\CMS\Http\Http as BaseHttp;
use Joomla\Registry\Registry;
use VDM\Gitea\AbstractGiteaObject;
abstract class AbstractPackage extends AbstractGiteaObject
{
/**
* Constructor.
*
* @param Registry $options Gitea options object.
* @param Http $client The HTTP client object.
*
* @since 1.0
*/
public function __construct(Registry $options = null, BaseHttp $client = null)
{
parent::__construct($options, $client);
$this->package = static::class;
$this->package = substr($this->package, strrpos($this->package, '\\') + 1);
}
/**
* Magic method to lazily create API objects
*
* @param string $name Name of property to retrieve
*
* @since 1.0
* @throws \InvalidArgumentException
*
* @return AbstractPackage Gitea API package object.
*/
public function __get($name)
{
$class = '\\VDM\\Gitea\\Package\\' . $this->package . '\\' . ucfirst($name);
if (class_exists($class) == false)
{
throw new \InvalidArgumentException(
sprintf(
'Argument %1$s produced an invalid class name: %2$s in package %3$s',
$name, $class, $this->package
)
);
}
if (isset($this->$name) == false)
{
$this->$name = new $class($this->options, $this->client);
}
return $this->$name;
}
}

View File

@ -1,123 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Gitea;
use Joomla\CMS\Http\Http as BaseHttp;
use Joomla\CMS\Http\HttpFactory;
use Joomla\Registry\Registry;
class Gitea
{
/**
* Options for the Gitea object.
*
* @var array
* @since 1.0
*/
protected $options;
/**
* The HTTP client object to use in sending HTTP requests.
*
* @var BaseHttp
* @since 1.0
*/
protected $client;
/**
* Constructor.
*
* @param Registry $options Gitea options object.
* @param Http $client The HTTP client object.
*
* @since 1.0
*/
public function __construct(Registry $options = null, BaseHttp $client = null)
{
$this->options = $options ?: new Registry;
// Setup the default user agent if not already set.
if (!$this->getOption('userAgent'))
{
$this->setOption('userAgent', 'JGitea/1.0');
}
// Setup the default API url if not already set.
if (!$this->getOption('api.url'))
{
$this->setOption('api.url', 'https://git.vdm.dev/api/v1');
}
$this->client = $client ?: (new HttpFactory)->getHttp($this->options);
}
/**
* Magic method to lazily create API objects
*
* @param string $name Name of property to retrieve
*
* @return AbstractGiteaObject Gitea API object (issues, pulls, etc).
*
* @since 1.0
* @throws \InvalidArgumentException If $name is not a valid sub class.
*/
public function __get($name)
{
$class = '\\VDM\\Gitea\\Package\\' . ucfirst($name);
if (class_exists($class))
{
if (isset($this->$name) == false)
{
$this->$name = new $class($this->options, $this->client);
}
return $this->$name;
}
throw new \InvalidArgumentException(sprintf('Argument %s produced an invalid class name: %s', $name, $class));
}
/**
* Get an option from the Gitea instance.
*
* @param string $key The name of the option to get.
*
* @return mixed The option value.
*
* @since 1.0
*/
public function getOption($key)
{
return isset($this->options[$key]) ? $this->options[$key] : null;
}
/**
* Set an option for the Gitea instance.
*
* @param string $key The name of the option to set.
* @param mixed $value The option value to set.
*
* @return Gitea This object for method chaining.
*
* @since 1.0
*/
public function setOption($key, $value)
{
$this->options[$key] = $value;
return $this;
}
}

View File

@ -1,266 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @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\Gitea\Package;
use Joomla\CMS\Http\Http;
use Joomla\Registry\Registry;
use VDM\Gitea\AbstractPackage;
class Repo extends AbstractPackage
{
/**
* List your repositories.
*
* List repositories for the authenticated user.
*
* @return object
*
* @since 1.0
*/
public function getListOwn()
{
// Build the request path.
$uri = $this->fetchUrl('/user/repos');
// Send the request.
return $this->processResponse($this->client->get($uri));
}
/**
* List user repositories.
*
* List public repositories for the specified user.
*
* @param string $user The user name.
*
* @return object
*
* @since 1.0
*/
public function getListUser($user)
{
// Build the request path.
$uri = $this->fetchUrl('/users/' . $user . '/repos');
// Send the request.
return $this->processResponse($this->client->get($uri));
}
/**
* List organization repositories.
*
* List repositories for the specified org.
*
* @param string $org The name of the organization.
*
* @return object
*
* @since 1.0
*/
public function getListOrg($org)
{
// Build the request path.
$uri = $this->fetchUrl('/orgs/' . $org . '/repos');
// Send the request.
return $this->processResponse($this->client->get($uri));
}
/**
* Create.
*
* Create a new repository for the authenticated user or an organization. OAuth users must supply repo scope.
*
* @param string $name The repository name.
* @param string $org The organization name (if needed).
* @param string $description The repository description.
* @param string $readme Readme of the repository to create.
* @param boolean $private Set true to create a private repository, false to create a public one.
* @param string $defaultBranch DefaultBranch of the repository (used when initializes and in template).
* @param string $license License to use.
* @param boolean $autoInit Whether the repository should auto init.
* @param boolean $template Whether the repository is template.
* @param string $gitignores Gitignores to use.
* options: [ Joomla, JetBrains ] and much more...
* @param string $issueLabels Label-Set to use.
* @param string $trustModel TrustModel of the repository.
* options: [ default, collaborator, committer, collaboratorcommitter ]
*
* @return object
*
* @since 1.0
*/
public function create($name, $org = '', $description = '', $readme = 'Default', $private = false, $defaultBranch = 'master',
$license = 'GPL-2.0-or-later', $autoInit = true, $template = false, $trustModel = 'default', $gitignores = '', $issueLabels = ''
)
{
$path = ($org)
// Create a repository for an organization
? '/orgs/' . $org . '/repos'
// Create a repository for a user
: '/user/repos';
$data = [
'name' => $name,
'description' => $description,
'readme' => $readme,
'private' => $private,
'auto_init' => $autoInit,
'default_branch' => $defaultBranch,
'issue_labels' => $issueLabels,
'license' => $license,
'template' => $template,
'gitignores' => $gitignores,
'trust_model' => $trustModel
];
// Send the request.
return $this->processResponse(
$this->client->post($this->fetchUrl($path), json_encode($data)),
201
);
}
/**
* Get.
*
* @param string $owner Repository owner.
* @param string $repo Repository name.
*
* @return object
*
* @since 1.0
*/
public function get($owner, $repo)
{
// Build the request path.
$path = '/repos/' . $owner . '/' . $repo;
// Send the request.
return $this->processResponse(
$this->client->get($this->fetchUrl($path))
);
}
/**
* List contributors.
*
* @param string $owner Repository owner.
* @param string $repo Repository name.
*
* @return object
*
* @since 1.0
*/
public function getListContributors($owner, $repo)
{
// Build the request path.
$uri = $this->fetchUrl('/repos/' . $owner . '/' . $repo . '/contributors');
// Send the request.
return $this->processResponse($this->client->get($uri));
}
/**
* List languages.
*
* List languages for the specified repository. The value on the right of a language is the number of bytes of code
* written in that language.
*
* @param string $owner Repository owner.
* @param string $repo Repository name.
*
* @return object
*
* @since 1.0
*/
public function getListLanguages($owner, $repo)
{
// Build the request path.
$path = '/repos/' . $owner . '/' . $repo . '/languages';
// Send the request.
return $this->processResponse(
$this->client->get($this->fetchUrl($path))
);
}
/**
* List Teams
*
* @param string $owner Repository owner.
* @param string $repo Repository name.
*
* @return object
*
* @since 1.0
*/
public function getListTeams($owner, $repo)
{
// Build the request path.
$path = '/repos/' . $owner . '/' . $repo . '/teams';
// Send the request.
return $this->processResponse(
$this->client->get($this->fetchUrl($path))
);
}
/**
* List Tags.
*
* @param string $owner Repository owner.
* @param string $repo Repository name.
* @param integer $page Page to request
* @param integer $limit Number of results to return per page
*
* @return object
*
* @since 1.0
*/
public function getListTags($owner, $repo, $page = 0, $limit = 0)
{
// Build the request path.
$path = '/repos/' . $owner . '/' . $repo . '/tags';
// Send the request.
return $this->processResponse(
$this->client->get($this->fetchUrl($path, $page, $limit))
);
}
/**
* Delete a Repository.
*
* Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required.
*
* @param string $owner Repository owner.
* @param string $repo Repository name.
*
* @return object
*
* @since 1.0
*/
public function delete($owner, $repo)
{
// Build the request path.
$path = '/repos/' . $owner . '/' . $repo;
// Send the request.
return $this->processResponse(
$this->client->delete($this->fetchUrl($path))
);
}
}

View File

@ -1,49 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Gitea\Package\Repo;
use Joomla\CMS\Http\Http;
use Joomla\Registry\Registry;
use VDM\Gitea\AbstractPackage;
/**
* Start looking here:
* https://git.vdm.dev/api/swagger#/repository/repoGetContents
*/
class File extends AbstractPackage
{
/**
* Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir
*
* @param string $owner Repository owner.
* @param string $repo Repository name.
* @param string $filepath Repository file path.
*
* @return object
*
* @since 1.0
*/
public function get($owner, $repo, $filepath)
{
// Build the request path.
$path = '/repos/' . $owner . '/' . $repo . '/contents/' . $filepath;
// Send the request.
return $this->processResponse(
$this->client->get($this->fetchUrl($path))
);
}
}

View File

@ -1,93 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Gitea\Package\Repo;
use Joomla\CMS\Http\Http;
use Joomla\Registry\Registry;
use VDM\Gitea\AbstractPackage;
/**
* Start looking here:
* https://git.vdm.dev/api/swagger#/repository/repoCreateWikiPage
*/
class Wiki extends AbstractPackage
{
/**
* Get a repository wiki page
*
* @param string $owner The repository owner
* @param string $repo The repository name
* @param string $pageName The page name
*
* @return object
*
* @since 1.0
*/
public function get(string $owner, string $repo, string $pageName)
{
// Build the request path.
$path = '/repos/' . $owner . '/' . $repo . '/wiki/page/' . $pageName;
// Send the request.
return $this->processResponse(
$this->client->get($this->fetchUrl($path))
);
}
/**
* Get a repository wiki html page
*
* @param string $owner The repository owner
* @param string $repo The repository name
* @param string $pageName The page name
*
* @return object
*
* @since 1.0
*/
public function getHtml(string $owner, string $repo, string $pageName)
{
// get the gitea wiki page
$page = $this->get($owner, $repo, $pageName);
if (empty($page->content))
{
throw new \Exception('Wiki page could not be found.');
}
// Build the request path.
$path = '/markdown';
// Get headers
$headers = $this->client->getOption('headers', []);
$headers['accept'] = 'text/html';
$headers['Content-Type'] = 'application/json';
// build the post body
$data = [
'Context' => 'string',
'Mode' => 'string',
'Text' => $page->content,
'Wiki' => true
];
// Post the request.
return $this->processResponse(
$this->client->post($this->fetchUrl($path), json_encode($data), $headers)
);
}
}

View File

@ -0,0 +1,83 @@
<?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\Gitea\Abstraction;
use VDM\Joomla\Gitea\Utilities\Http;
use VDM\Joomla\Gitea\Utilities\Uri;
use VDM\Joomla\Gitea\Utilities\Response;
/**
* The Gitea Api
*
* @since 3.2.0
*/
abstract class Api
{
/**
* The Http class
*
* @var Http
* @since 3.2.0
*/
protected Http $http;
/**
* The Uri class
*
* @var Uri
* @since 3.2.0
*/
protected Uri $uri;
/**
* The Response class
*
* @var Response
* @since 3.2.0
*/
protected Response $response;
/**
* Constructor.
*
* @param Http $http The http class.
* @param Uri $uri The uri class.
* @param Response $response The response class.
*
* @since 3.2.0
**/
public function __construct(Http $http, Uri $uri, Response $response)
{
$this->http = $http;
$this->uri = $uri;
$this->response = $response;
}
/**
* Load/Reload API.
*
* @param string $url The url.
* @param token $token The token.
*
* @return void
* @since 3.2.0
**/
public function load_(string $url, string $token)
{
$this->uri->setUrl($url);
$this->http->setToken($token);
}
}

View File

@ -0,0 +1,72 @@
<?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\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Cron
*
* @since 3.2.0
*/
class Cron extends Api
{
/**
* List cron tasks.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/admin/cron";
// Set the query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Run cron task.
*
* @param string $task The cron task to run.
*
* @return string
* @since 3.2.0
**/
public function run(string $task): string
{
// Build the request path.
$path = "/admin/cron/{$task}";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path)
), 204, 'success'
);
}
}

View File

@ -0,0 +1,51 @@
<?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\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Organizations
*
* @since 3.2.0
*/
class Organizations extends Api
{
/**
* List all organizations.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/admin/orgs";
// Set the query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}

View File

@ -0,0 +1,101 @@
<?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\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Unadopted
*
* @since 3.2.0
*/
class Unadopted extends Api
{
/**
* List unadopted repositories.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
* @param string $pattern Pattern of repositories to search for.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10, string $pattern = ''): ?array
{
// Build the request path.
$path = "/admin/unadopted";
// Set the query parameters.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
if (!empty($pattern))
{
$uri->setVar('pattern', $pattern);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Adopt unadopted files as a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function adopt(string $owner, string $repo): string
{
// Build the request path.
$path = "/admin/unadopted/{$owner}/{$repo}";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), ''
), 204, 'success'
);
}
/**
* Delete unadopted files.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo): string
{
// Build the request path.
$path = "/admin/unadopted/{$owner}/{$repo}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}

View File

@ -0,0 +1,207 @@
<?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\Gitea\Admin;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users
*
* @since 3.2.0
*/
class Users extends Api
{
/**
* List all users.
*
* @param int $page Page number of results to return (1-based).
* @param int $limit Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/admin/users";
// build the URL
$url = $this->uri->get($path);
$url->setVar('page', $page);
$url->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($url)
);
}
/**
* Create a user with extended options.
*
* @param string $loginName The user's login name.
* @param string $email The user's email address.
* @param string $password The user's password.
* @param string|null $username The username.
* @param string|null $fullName The user's full name (optional).
* @param bool|null $mustChangePassword User must change password on next login (optional).
* @param bool|null $restricted Restrict the user (optional).
* @param bool|null $sendNotify Send a notification email to the user (optional).
* @param int|null $sourceId Source ID (optional).
* @param string|null $visibility The user's visibility (optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $loginName,
string $email,
string $password,
string $username,
?string $fullName = null,
?bool $mustChangePassword = null,
?bool $restricted = null,
?bool $sendNotify = null,
?int $sourceId = null,
?string $visibility = null
): ?object
{
// Build the request path.
$path = "/admin/users";
// Set the user data.
$data = new \stdClass();
$data->login_name = $loginName;
$data->email = $email;
$data->password = $password;
$data->username = $username;
$data->full_name = $fullName;
$data->must_change_password = $mustChangePassword;
$data->restricted = $restricted;
$data->send_notify = $sendNotify;
$data->source_id = $sourceId;
$data->visibility = $visibility;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Delete a user.
*
* @param string $username The user's display name.
*
* @return string
* @since 3.2.0
**/
public function delete(string $username): string
{
// Build the request path.
$path = "/admin/users/{$username}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Edit an existing user.
*
* @param string $username The user's display name.
* @param string $loginName The user's login name.
* @param int $sourceId The user's source ID.
* @param bool $active Optional. Is the user active? Default: false.
* @param bool $admin Optional. Is the user an admin? Default: false.
* @param bool $allowCreateOrganization Optional. Can the user create an organization? Default: false.
* @param bool $allowGitHook Optional. Can the user create Git hooks? Default: false.
* @param bool $allowImportLocal Optional. Can the user import local repositories? Default: false.
* @param string $description Optional. The user's description. Default: ''.
* @param string $email Optional. The user's email address. Default: ''.
* @param string $fullName Optional. The user's full name. Default: ''.
* @param string $location Optional. The user's location. Default: ''.
* @param int $maxRepoCreation Optional. Maximum repositories the user can create. Default: 0.
* @param bool $mustChangePassword Optional. Must the user change their password? Default: false.
* @param string $password Optional. The user's password. Default: ''.
* @param bool $prohibitLogin Optional. Is the user's login prohibited? Default: false.
* @param bool $restricted Optional. Is the user restricted? Default: false.
* @param string $visibility Optional. The user's visibility setting. Default: ''.
* @param string $website Optional. The user's website. Default: ''.
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $username,
string $loginName,
int $sourceId,
bool $active = false,
bool $admin = false,
bool $allowCreateOrganization = false,
bool $allowGitHook = false,
bool $allowImportLocal = false,
string $description = '',
string $email = '',
string $fullName = '',
string $location = '',
int $maxRepoCreation = 0,
bool $mustChangePassword = false,
string $password = '',
bool $prohibitLogin = false,
bool $restricted = false,
string $visibility = '',
string $website = ''
): ?object
{
// Build the request path.
$path = "/admin/users/{$username}";
// Set the data.
$data = [
'login_name' => $loginName,
'source_id' => $sourceId,
'active' => $active,
'admin' => $admin,
'allow_create_organization' => $allowCreateOrganization,
'allow_git_hook' => $allowGitHook,
'allow_import_local' => $allowImportLocal,
'description' => $description,
'email' => $email,
'full_name' => $fullName,
'location' => $location,
'max_repo_creation' => $maxRepoCreation,
'must_change_password' => $mustChangePassword,
'password' => $password,
'prohibit_login' => $prohibitLogin,
'restricted' => $restricted,
'visibility' => $visibility,
'website' => $website
];
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
)
);
}
}

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\Gitea\Admin\Users;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users Keys
*
* @since 3.2.0
*/
class Keys extends Api
{
/**
* Add a public key on behalf of a user.
*
* @param string $userName The user's display name.
* @param string $publicKey The public key to add.
* @param string $keyTitle Title of the key to add.
* @param bool $readOnly Whether the key has only read access or read/write (optional).
* @param string|null $description Description of the key (optional).
*
* @return object|null
* @since 3.2.0
**/
public function add(
string $userName,
string $publicKey,
string $keyTitle,
bool $readOnly = false,
?string $description = null
): ?object
{
// Build the request path.
$path = "/admin/users/{$userName}/keys";
// Set the key data.
$data = new \stdClass();
$data->key = $publicKey;
$data->title = $keyTitle;
$data->read_only = $readOnly;
$data->description = $description;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
/**
* Delete a user's public key.
*
* @param string $username The user's display name.
* @param int $id The public key ID.
*
* @return string
* @since 3.2.0
**/
public function delete(string $username, int $id): string
{
// Build the request path.
$path = "/admin/users/{$username}/keys/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}

View File

@ -0,0 +1,70 @@
<?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\Gitea\Admin\Users;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users Organization
*
* @since 3.2.0
*/
class Organization extends Api
{
/**
* Create an organization on behalf of a user.
*
* @param string $username The user's display name.
* @param string $fullName The organization full name.
* @param string|null $description The organization description (optional).
* @param string|null $location The organization location (optional).
* @param bool $repoAdminChangeTeamAccess Whether repo admin can change team access (optional).
* @param string $visibility The organization visibility (optional).
* @param string|null $website The organization website (optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $username,
string $fullName,
?string $description = null,
?string $location = null,
bool $repoAdminChangeTeamAccess = false,
string $visibility = 'public',
?string $website = null
): ?object
{
// Build the request path.
$path = "/admin/users/{$username}/orgs";
// Set the organization data.
$data = new \stdClass();
$data->full_name = $fullName;
$data->description = $description;
$data->location = $location;
$data->repo_admin_change_team_access = $repoAdminChangeTeamAccess;
$data->visibility = $visibility;
$data->website = $website;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
}

View File

@ -0,0 +1,85 @@
<?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\Gitea\Admin\Users;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Admin Users Repository
*
* @since 3.2.0
*/
class Repository extends Api
{
/**
* Create a repository on behalf of a user.
*
* @param string $username The user's display name.
* @param string $repoName The repository name.
* @param string|null $description The repository description (optional).
* @param bool $auto_init Whether the repository should be auto-initialized? (optional).
* @param string|null $default_branch Default branch of the repository (optional).
* @param string|null $gitignores Gitignores to use (optional).
* @param string|null $issue_labels Label-Set to use (optional).
* @param string|null $license License to use (optional).
* @param bool $private Whether the repository is private (optional).
* @param string|null $readme Readme of the repository to create (optional).
* @param bool $template Whether the repository is template (optional).
* @param string|null $trust_model TrustModel of the repository (optional).
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $username,
string $repoName,
?string $description = null,
bool $auto_init = false,
?string $default_branch = null,
?string $gitignores = null,
?string $issue_labels = null,
?string $license = null,
bool $private = false,
?string $readme = null,
bool $template = false,
?string $trust_model = null
): ?object
{
// Build the request path.
$path = "/admin/users/{$username}/repos";
// Set the repository data.
$data = new \stdClass();
$data->name = $repoName;
$data->description = $description;
$data->auto_init = $auto_init;
$data->default_branch = $default_branch;
$data->gitignores = $gitignores;
$data->issue_labels = $issue_labels;
$data->license = $license;
$data->private = $private;
$data->readme = $readme;
$data->template = $template;
$data->trust_model = $trust_model;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
}

View File

@ -0,0 +1,97 @@
<?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\Gitea;
use Joomla\DI\Container;
use VDM\Joomla\Gitea\Service\Utilities;
use VDM\Joomla\Gitea\Service\Jcb;
use VDM\Joomla\Gitea\Service\Settings;
use VDM\Joomla\Gitea\Service\Organization;
use VDM\Joomla\Gitea\Service\User;
use VDM\Joomla\Gitea\Service\Repository;
use VDM\Joomla\Gitea\Service\Package;
use VDM\Joomla\Gitea\Service\Issue;
use VDM\Joomla\Gitea\Service\Notifications;
use VDM\Joomla\Gitea\Service\Miscellaneous;
use VDM\Joomla\Gitea\Service\Admin;
use VDM\Joomla\Componentbuilder\Interfaces\FactoryInterface;
/**
* Gitea 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 Utilities())
->registerServiceProvider(new Jcb())
->registerServiceProvider(new Settings())
->registerServiceProvider(new Organization())
->registerServiceProvider(new User())
->registerServiceProvider(new Repository())
->registerServiceProvider(new Package())
->registerServiceProvider(new Issue())
->registerServiceProvider(new Notifications())
->registerServiceProvider(new Miscellaneous())
->registerServiceProvider(new Admin());
}
}

View File

@ -0,0 +1,406 @@
<?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\Gitea;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue
*
* @since 3.2.0
*/
class Issue extends Api
{
/**
* List a repository's issues.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $state The state of the issues to get, defaults to 'open'.
* @param int $page The page to get, defaults to null.
* @param int $limit The number of issues per page, defaults to null.
* @param string|null $labels Comma-separated list of labels, defaults to null.
* @param string|null $q The search string, defaults to null.
* @param string|null $type The type to filter by (issues/pulls), defaults to null.
* @param string|null $milestones Comma-separated list of milestone names or IDs, defaults to null.
* @param string|null $since Only show items updated after the given time, defaults to null.
* @param string|null $before Only show items updated before the given time, defaults to null.
* @param string|null $createdBy Only show items created by the given user, defaults to null.
* @param string|null $assignedBy Only show items assigned to the given user, defaults to null.
* @param string|null $mentionedBy Only show items where the given user is mentioned, defaults to null.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
string $state = 'open',
int $page = 1,
int $limit = 10,
?string $labels = null,
?string $q = null,
?string $type = null,
?string $milestones = null,
?string $since = null,
?string $before = null,
?string $createdBy = null,
?string $assignedBy = null,
?string $mentionedBy = null
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues";
// Build the URI.
$uri = $this->uri->get($path);
// Set the query parameters
$uri->setVar('state', $state);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
$uri->setVar('labels', $labels);
$uri->setVar('q', $q);
$uri->setVar('type', $type);
$uri->setVar('milestones', $milestones);
$uri->setVar('since', $since);
$uri->setVar('before', $before);
$uri->setVar('created_by', $createdBy);
$uri->setVar('assigned_by', $assignedBy);
$uri->setVar('mentioned_by', $mentionedBy);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, int $index): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Create an issue. If using deadline only the date will be taken into account, and time of day ignored.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $issueTitle The issue title.
* @param array|null $assignees The array of assignees, defaults to null.
* @param string|null $issueBody The issue body, defaults to null.
* @param bool|null $closed If the issue is closed, defaults to null.
* @param string|null $dueDate The deadline for the issue, format: "YYYY-MM-DD", defaults to null.
* @param array|null $labelIds The array of label IDs to attach to the issue, defaults to null.
* @param int|null $milestoneId The milestone ID, defaults to null.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $issueTitle,
?array $assignees = null,
?string $issueBody = null,
?bool $closed = null,
?string $dueDate = null,
?array $labelIds = null,
?int $milestoneId = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues";
// Build the request data.
$data = new \stdClass();
$data->title = $issueTitle;
$data->body = $issueBody;
$data->assignees = $assignees;
$data->closed = $closed;
$data->due_date = $dueDate;
$data->labels = $labelIds;
$data->milestone = $milestoneId;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Search for issues across the repositories that the user has access to.
*
* @param string $q Search query.
* @param int $page Page number (default 1).
* @param int $limit Page size (default 10, max 50).
* @param string|null $state Issue state (default open).
* @param string|null $labels Label filter, comma-separated.
* @param string|null $milestones Milestone filter, comma-separated.
* @param int|null $priorityRepoId Repository to prioritize in the results.
* @param string|null $type Filter by type (issues/pulls).
* @param string|null $since Only show notifications updated after the given time (RFC 3339 format).
* @param string|null $before Only show notifications updated before the given time (RFC 3339 format).
* @param bool|null $assigned Filter assigned to you (default false).
* @param bool|null $created Filter created by you (default false).
* @param bool|null $mentioned Filter mentioning you (default false).
* @param bool|null $reviewRequested Filter pulls requesting your review (default false).
* @param string|null $owner Filter by owner.
* @param string|null $team Filter by team (requires organization owner parameter).
*
* @return array|null
* @since 3.2.0
**/
public function search(
string $q,
int $page = 1,
int $limit = 10,
?string $state = 'open',
?string $labels = null,
?string $milestones = null,
?int $priorityRepoId = null,
?string $type = null,
?string $since = null,
?string $before = null,
?bool $assigned = null,
?bool $created = null,
?bool $mentioned = null,
?bool $reviewRequested = null,
?string $owner = null,
?string $team = null
): ?array
{
// Build the request path.
$path = "/repos/issues/search";
// Set the URL parameters.
$uri = $this->uri->get($path);
$uri->setVar('q', $q);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
$uri->setVar('state', $state);
if ($labels !== null)
{
$uri->setVar('labels', $labels);
}
if ($milestones !== null)
{
$uri->setVar('milestones', $milestones);
}
if ($priorityRepoId !== null)
{
$uri->setVar('priority_repo_id', $priorityRepoId);
}
if ($type !== null)
{
$uri->setVar('type', $type);
}
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
if ($assigned !== null)
{
$uri->setVar('assigned', $assigned);
}
if ($created !== null)
{
$uri->setVar('created', $created);
}
if ($mentioned !== null)
{
$uri->setVar('mentioned', $mentioned);
}
if ($reviewRequested !== null)
{
$uri->setVar('review_requested', $reviewRequested);
}
if ($owner !== null)
{
$uri->setVar('owner', $owner);
}
if ($team !== null)
{
$uri->setVar('team', $team);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Edit an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string|null $assignee The assignee, defaults to null.
* @param array|null $assignees The assignees, defaults to null.
* @param string|null $body The issue body, defaults to null.
* @param string|null $dueDate The due date, defaults to null.
* @param int|null $milestone The milestone, defaults to null.
* @param string|null $ref The reference, defaults to null.
* @param string|null $state The issue state, defaults to null.
* @param string|null $title The issue title, defaults to null.
* @param bool|null $unsetDueDate The flag to unset due date, defaults to null.
*
* @return object|null
* @since 3.2.0
**/
public function edit(
string $owner,
string $repo,
int $index,
?string $assignee = null,
?array $assignees = null,
?string $body = null,
?string $dueDate = null,
?int $milestone = null,
?string $ref = null,
?string $state = null,
?string $title = null,
?bool $unsetDueDate = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}";
// Prepare the issue data.
$editIssueData = new \stdClass();
if ($assignee !== null || $assignees !== null)
{
$editIssueData->assignee = new \stdClass();
if ($assignee !== null)
{
$editIssueData->assignee->name = $assignee;
}
if ($assignees !== null)
{
$editIssueData->assignee->names = $assignees;
}
}
if ($body !== null)
{
$editIssueData->body = $body;
}
if ($dueDate !== null || $unsetDueDate !== null)
{
$editIssueData->dueDate = new \stdClass();
if ($dueDate !== null)
{
$editIssueData->dueDate->date = $dueDate;
}
if ($unsetDueDate !== null)
{
$editIssueData->dueDate->unset = $unsetDueDate;
}
}
if ($milestone !== null)
{
$editIssueData->milestone = $milestone;
}
if ($ref !== null)
{
$editIssueData->ref = $ref;
}
if ($state !== null)
{
$editIssueData->state = $state;
}
if ($title !== null)
{
$editIssueData->title = $title;
}
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($editIssueData)
)
);
}
/**
* Delete an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}

View File

@ -0,0 +1,176 @@
<?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\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Comments
*
* @since 3.2.0
*/
class Comments extends Api
{
/**
* List all comments on an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int $page The page number to get, defaults to 1.
* @param int $limit The number of comments per page, defaults to 10.
* @param string|null $since The date-time since when to get comments, defaults to null.
* @param string|null $before The date-time before when to get comments, defaults to null.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
int $index,
int $page = 1,
int $limit = 10,
?string $since = null,
?string $before = null
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/comments";
// Build the URI.
$uri = $this->uri->get($path);
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Set the 'since' and 'before' parameters if not null.
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a comment.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, int $commentId): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/comments/{$commentId}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a comment.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, int $commentId): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/comments/{$commentId}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Edit a comment.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
* @param string $commentBody The new comment body.
*
* @return object|null
* @since 3.2.0
**/
public function edit(string $owner, string $repo, int $commentId, string $commentBody): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/comments/{$commentId}";
// Build the request data.
$data = new \stdClass();
$data->body = $commentBody;
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Add a comment to an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $issueIndex The issue index.
* @param string $commentBody The comment body.
*
* @return object|null
* @since 3.2.0
**/
public function add(string $owner, string $repo, int $issueIndex, string $commentBody): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$issueIndex}/comments";
// Build the request data.
$data = new \stdClass();
$data->body = $commentBody;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
), 201
);
}
}

View File

@ -0,0 +1,54 @@
<?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\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Deadline
*
* @since 3.2.0
*/
class Deadline extends Api
{
/**
* Set an issue deadline.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string|null $dueDate The deadline date string in the format YYYY-MM-DD or null to delete the deadline.
*
* @return object
* @since 3.2.0
**/
public function set(string $owner, string $repo, int $index, ?string $dueDate): object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/deadline";
// Build the request data.
$data = new \stdClass();
$data->due_date = $dueDate;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
}

View File

@ -0,0 +1,181 @@
<?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\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Labels
*
* @since 3.2.0
*/
class Labels extends Api
{
/**
* Get all of a repository's labels.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $page The page number of results to return (1-based).
* @param int $limit The page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $owner, string $repo, int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/labels";
// Get the URI object with the request path.
$uri = $this->uri->get($path);
// Add the page and limit query parameters if provided.
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get an issue's labels.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return array|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, int $index): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/labels";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Replace an issue's labels.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param array $labels An array of labels to replace the current issue labels.
*
* @return object
* @since 3.2.0
**/
public function replace(string $owner, string $repo, int $index, array $labels): object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/labels";
// Build the request data.
$data = new \stdClass();
$data->labels = $labels;
// Send the put request.
return $this->response->get(
$this->http->put(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Add a label to an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param array $labels An array of label IDs to add.
*
* @return array|null
* @since 3.2.0
**/
public function add(string $owner, string $repo, int $index, array $labels): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/labels";
// Build the request data.
$data = new \stdClass();
$data->labels = $labels;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Remove a label from an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int $labelId The ID of the label to remove.
*
* @return string
* @since 3.2.0
**/
public function remove(string $owner, string $repo, int $index, int $labelId): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/labels/{$labelId}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Remove all labels from an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function clear(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/labels";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}

View File

@ -0,0 +1,230 @@
<?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\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Milestones
*
* @since 3.2.0
*/
class Milestones extends Api
{
/**
* Create a milestone.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $title The title of the milestone.
* @param string|null $description Optional. The description of the milestone.
* @param string|null $dueOn Optional. The due date of the milestone.
* @param string|null $state Optional. The state of the milestone. Default is 'open'.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $title,
?string $description = null,
?string $dueOn = null,
?string $state = 'open'
): ?object
{
// Set the lines data
$data = new \stdClass();
// Set all the required data.
$data->title = $title;
// Set all the optional data that has been provided.
if ($description !== null)
{
$data->description = $description;
}
if ($dueOn !== null)
{
$data->due_on = $dueOn;
}
if ($state !== null)
{
$data->state = $state;
}
// Build the request path.
$path = "/repos/{$owner}/{$repo}/milestones";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Get all of a repository's opened milestones.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string|null $state Optional. Milestone state. Recognized values are open, closed, and all. Defaults to "open".
* @param string|null $name Optional. Filter by milestone name.
* @param int|null $page Optional. Page number of results to return (1-based).
* @param int|null $limit Optional. Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
?string $state = 'open',
?string $name = null,
?int $page = null,
?int $limit = null
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/milestones";
// Build the URI.
$uri = $this->uri->get($path);
$uri->setVar('state', $state);
if ($name !== null)
{
$uri->setVar('name', $name);
}
if ($page !== null)
{
$uri->setVar('page', $page);
}
if ($limit !== null)
{
$uri->setVar('limit', $limit);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Get a milestone.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $milestoneId The ID of the milestone.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, string $milestoneId): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/milestones/{$milestoneId}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a milestone.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $milestoneId The ID of the milestone to delete.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, string $milestoneId): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/milestones/{$milestoneId}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Update a milestone.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $milestoneId The ID of the milestone to update.
* @param string $title Optional. The new title of the milestone.
* @param string $description Optional. The new description of the milestone.
* @param string $dueOn Optional. The new due date of the milestone.
* @param string $state Optional. The new state of the milestone.
*
* @return object|null
* @since 3.2.0
**/
public function update(
string $owner,
string $repo,
string $milestoneId,
string $title = null,
string $description = null,
string $dueOn = null,
string $state = null
): ?object
{
// Set the lines data
$data = new \stdClass();
// Set all the optional data that has been provided.
if ($title !== null)
{
$data->title = $title;
}
if ($description !== null)
{
$data->description = $description;
}
if ($dueOn !== null)
{
$data->due_on = $dueOn;
}
if ($state !== null)
{
$data->state = $state;
}
// Build the request path.
$path = "/repos/{$owner}/{$repo}/milestones/{$milestoneId}";
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path),
json_encode($data)
)
);
}
}

View File

@ -0,0 +1,110 @@
<?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\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Reactions
*
* @since 3.2.0
*/
class Reactions extends Api
{
/**
* Get a list reactions of an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int $page The page to get, defaults to 1.
* @param int $limit The number of reactions per page, defaults to 10.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $owner, string $repo, int $index, int $page = 1, int $limit = 10): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/reactions";
// Build the URI.
$uri = $this->uri->get($path);
// Set the URI variables.
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Add a reaction to an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string $content The name of the reaction to add.
*
* @return object|null
* @since 3.2.0
**/
public function add(string $owner, string $repo, int $index, string $content): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/reactions";
// Build the request data.
$data = new \stdClass();
$data->content = $content;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Remove a reaction from an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string $content The name of the reaction to remove.
*
* @return string
* @since 3.2.0
**/
public function remove(string $owner, string $repo, int $index, string $content): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/reactions";
// Build the URI.
$uri = $this->uri->get($path);
$uri->setVar('content', $content);
// Send the delete request.
return $this->response->get(
$this->http->delete($uri), 200, 'success'
);
}
}

View File

@ -0,0 +1,103 @@
<?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\Gitea\Issue\Reactions;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Reactions Comment
*
* @since 3.2.0
*/
class Comment extends Api
{
/**
* Get a list of reactions from a comment of an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $owner, string $repo, int $commentId): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/comments/{$commentId}/reactions";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Add a reaction to a comment of an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
* @param string $content The reaction to add, e.g. "+1".
*
* @return object|null
* @since 3.2.0
**/
public function add(string $owner, string $repo, int $commentId, string $content): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/comments/{$commentId}/reactions";
// Build the request data.
$data = new \stdClass();
$data->content = $content;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}
/**
* Remove a reaction from a comment of an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $commentId The comment ID.
* @param string $content The reaction to remove, e.g. "+1".
*
* @return string
* @since 3.2.0
**/
public function remove(string $owner, string $repo, int $commentId, string $content): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/comments/{$commentId}/reactions";
// Build the URI.
$uri = $this->uri->get($path);
$uri->setVar('content', $content);
// Send the delete request.
return $this->response->get(
$this->http->delete($uri), 200, 'success'
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,67 @@
<?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\Gitea\Issue\Repository;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Repository Comments
*
* @since 3.2.0
*/
class Comments extends Api
{
/**
* List all comments in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $page The page to get, defaults to 1.
* @param int $limit The number of comments per page, defaults to 10.
* @param string|null $since The date-time string to filter updated comments since, defaults to null.
* @param string|null $before The date-time string to filter updated comments before, defaults to null.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $owner, string $repo, int $page = 1, int $limit = 10, ?string $since = null, ?string $before = null): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/comments";
// Build the URI.
$uri = $this->uri->get($path);
// Set the URI variables.
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,95 @@
<?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\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Stopwatch
*
* @since 3.2.0
*/
class Stopwatch extends Api
{
/**
* Start stopwatch on an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function start(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/stopwatch/start";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), ''
), 201, 'success'
);
}
/**
* Stop an issue's existing stopwatch.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function stop(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/stopwatch/stop";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), ''
), 201, 'success'
);
}
/**
* Delete an issue's existing stopwatch.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/stopwatch/delete";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}

View File

@ -0,0 +1,137 @@
<?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\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Subscriptions
*
* @since 3.2.0
*/
class Subscriptions extends Api
{
/**
* Get users who subscribed on an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int|null $page Optional. Page number of results to return (1-based).
* @param int|null $limit Optional. Page size of results.
*
* @return object|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
int $index,
?int $page = null,
?int $limit = null
): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/subscriptions";
// Set the query parameters.
$uri = $this->uri->get($path);
if ($page !== null)
{
$uri->setVar('page', $page);
}
if ($limit !== null)
{
$uri->setVar('limit', $limit);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Check if user is subscribed to an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return object|null
* @since 3.2.0
**/
public function check(string $owner, string $repo, int $index): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/subscriptions/check";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Subscribe user to issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string $user The username to subscribe.
*
* @return string
* @since 3.2.0
**/
public function subscribe(string $owner, string $repo, int $index, string $user): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/subscriptions/{$user}";
// Send the put request.
return $this->response->get_(
$this->http->put(
$this->uri->get($path), ''
), [200 => 'already subscribed', 201 => 'success']
);
}
/**
* Unsubscribe user from issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string $user The username to unsubscribe.
*
* @return string
* @since 3.2.0
**/
public function unsubscribe(string $owner, string $repo, int $index, string $user): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/subscriptions/{$user}";
// Send the delete request.
return $this->response->get_(
$this->http->delete(
$this->uri->get($path)
), [200 => 'already unsubscribed', 201 => 'success']
);
}
}

View File

@ -0,0 +1,78 @@
<?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\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Timeline
*
* @since 3.2.0
*/
class Timeline extends Api
{
/**
* List all comments and events on an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string|null $since Optional. If provided, only comments updated since the specified time are returned.
* @param int|null $page Optional. Page number of results to return (1-based).
* @param int|null $limit Optional. Page size of results.
* @param string|null $before Optional. If provided, only comments updated before the provided time are returned.
*
* @return array|null
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
int $index,
?string $since = null,
?int $page = null,
?int $limit = null,
?string $before = null
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/timeline";
// Set the query parameters.
$uri = $this->uri->get($path);
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($page !== null)
{
$uri->setVar('page', $page);
}
if ($limit !== null)
{
$uri->setVar('limit', $limit);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}
}

View File

@ -0,0 +1,179 @@
<?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\Gitea\Issue;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Issue Times
*
* @since 3.2.0
*/
class Times extends Api
{
/**
* List an issue's tracked times.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string $user Optional. Filter by user.
* @param string $since Optional. Show times updated after the given time.
* @param string $before Optional. Show times updated before the given time.
* @param int $page Optional. Page number of results to return (1-based).
* @param int $limit Optional. Page size of results.
*
* @return array|null
* @since 3.2.0
**/
public function list(
string $owner,
string $repo,
int $index,
string $user = null,
string $since = null,
string $before = null,
int $page = null,
int $limit = null
): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/times";
// Prepare the query parameters.
$uri = $this->uri->get($path);
if ($user !== null)
{
$uri->setVar('user', $user);
}
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
if ($page !== null)
{
$uri->setVar('page', $page);
}
if ($limit !== null)
{
$uri->setVar('limit', $limit);
}
// Send the get request with the query parameters.
return $this->response->get(
$this->http->get($uri)
);
}
/**
* Add tracked time to an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int $time The tracked time in seconds.
* @param string $created Optional. The date and time of the tracked time in RFC 3339 format.
* @param string $userName Optional. User who spent the time.
*
* @return object|null
* @since 3.2.0
**/
public function add(
string $owner,
string $repo,
int $index,
int $time,
string $created = null,
string $userName = null
): ?object
{
// Set the lines data
$data = new \stdClass();
// Set all the needed data.
$data->time = $time;
if ($created !== null)
{
$data->created = $created;
}
if ($userName !== null)
{
$data->user_name = $userName;
}
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/times";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
)
);
}
/**
* Reset a tracked time of an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function reset(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/times";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Delete specific tracked time.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param int $id The ID of the tracked time to delete.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, int $index, int $id): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/times/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,162 @@
<?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\Gitea;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Labels
*
* @since 3.2.0
*/
class Labels extends Api
{
/**
* Create a label.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $labelName The name of the label.
* @param string $labelColor The color of the label, in hexadecimal format with the leading '#'.
* @param string $labelDescription Optional. The description of the label.
*
* @return object|null
* @since 3.2.0
**/
public function create(string $owner, string $repo, string $labelName, string $labelColor, string $labelDescription = ''): ?object
{
// Set the lines data
$data = new \stdClass();
// Set all the needed data.
$data->name = $labelName;
$data->color = $labelColor;
if (!empty($labelDescription))
{
$data->description = $labelDescription;
}
// Build the request path.
$path = "/repos/{$owner}/{$repo}/labels";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data)
), 201
);
}
/**
* Get a single label.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $id The ID of the label to retrieve.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $owner, string $repo, string $id): ?object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/labels/{$id}";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Delete a label.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $id The ID of the label to delete.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, string $id): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/labels/{$id}";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}
/**
* Update a label.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param string $id The ID of the label to update.
* @param string $labelName Optional. The new name of the label.
* @param string $labelColor Optional. The new color of the label, in hexadecimal format without the leading '#'.
* @param string $labelDescription Optional. The new description of the label.
*
* @return object|null
* @since 3.2.0
**/
public function update(
string $owner,
string $repo,
string $id,
string $labelName = '',
string $labelColor = '',
string $labelDescription = ''
): ?object
{
// Set the lines data
$data = new \stdClass();
// Set all the optional data that has been provided.
if (!empty($labelName))
{
$data->name = $labelName;
}
if (!empty($labelColor))
{
$data->color = $labelColor;
}
if (!empty($labelDescription))
{
$data->description = $labelDescription;
}
// Build the request path.
$path = "/repos/{$owner}/{$repo}/labels/{$id}";
// Send the patch request.
return $this->response->get(
$this->http->patch(
$this->uri->get($path),
json_encode($data)
)
);
}
}

View File

@ -0,0 +1,69 @@
<?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\Gitea\Miscellaneous;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Miscellaneous Activitypub
*
* @since 3.2.0
*/
class Activitypub extends Api
{
/**
* Returns the Person actor for a user.
*
* @param string $username The user's username.
*
* @return object|null
* @since 3.2.0
**/
public function get(string $username): ?object
{
// Build the request path.
$path = "/activitypub/user/{$username}";
// Send the GET request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
/**
* Send to the user's inbox.
*
* @param string $username The user's username.
* @param object $postData The post data.
*
* @return string
* @since 3.2.0
**/
public function send(string $username, object $postData): string
{
// Build the request path.
$path = "/activitypub/user/{$username}/inbox";
// Send the POST request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($postData)
), 204, 'success'
);
}
}

View File

@ -0,0 +1,45 @@
<?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\Gitea\Miscellaneous;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Miscellaneous Gpg
*
* @since 3.2.0
*/
class Gpg extends Api
{
/**
* Get default signing-key.gpg.
*
* @return string|null
* @since 3.2.0
**/
public function get(): ?string
{
// Build the request path.
$path = "/signing-key.gpg";
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}

View File

@ -0,0 +1,87 @@
<?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\Gitea\Miscellaneous;
use VDM\Joomla\Gitea\Abstraction\Api;
/**
* The Gitea Miscellaneous Markdown
*
* @since 3.2.0
*/
class Markdown extends Api
{
/**
* Render a markdown document as HTML.
*
* @param string $markdownText The markdown text to render.
* @param bool $isWikiPage Is it a wiki page?
* @param string $context Context to render.
* @param string $mode Mode to render.
*
* @return string|null
* @since 3.2.0
**/
public function render(
string $markdownText,
bool $isWikiPage = false,
string $context = 'string',
string $mode = 'string'
): ?string
{
// Build the request path.
$path = "/markdown";
// Set the markdown data.
$data = new \stdClass();
$data->Text = $markdownText;
$data->Wiki = $isWikiPage;
$data->Context = $context;
$data->Mode = $mode;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
json_encode($data),
['accept' => 'text/html']
)
);
}
/**
* Render raw markdown as HTML.
*
* @param string $rawMarkdown The raw markdown text to render.
*
* @return string|null
* @since 3.2.0
**/
public function raw(string $rawMarkdown): ?string
{
// Build the request path.
$path = "/markdown/raw";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path),
$rawMarkdown,
['Content-Type' => 'text/plain', 'accept' => 'text/html']
)
);
}
}

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