Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
df16b2e3ad
|
|||
d6c73987f5
|
|||
737bd03e46
|
|||
339aec221e
|
|||
7fa8964b44
|
|||
7edbe20c33
|
|||
e6c02a29f6
|
|||
f44f385159
|
|||
e8abe8e3cf
|
|||
e771e7d243
|
|||
e614f2ec23
|
|||
d28e4c74af
|
|||
a2ec013566
|
|||
4217b22f67
|
|||
6c42b5af61
|
|||
1c7515d0f5
|
|||
9f5c7deec8
|
|||
7759738938
|
|||
461edf5c3f
|
|||
9f30f30b9e
|
|||
f1cb398f7a
|
|||
f2ea22d0ad
|
|||
869a1879cb
|
|||
d4843d6696
|
|||
9db33ad449
|
21
.github/CONTRIBUTING.md
vendored
21
.github/CONTRIBUTING.md
vendored
@ -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
39
.github/SUPPORT.md
vendored
@ -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
27
CHANGELOG.md
Normal 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
|
62
README.md
62
README.md
@ -1,5 +1,5 @@
|
||||
|
||||
# Joomla Component Builder ([JCB](http://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)
|
||||
|
||||
@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
|
||||
|
||||
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.8) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
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)
|
||||
|
||||
@ -23,8 +23,8 @@ Some of the Features
|
||||
+ 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](http://joomlacomponentbuilder.com)
|
||||
+ [Automated backup system](https://www.youtube.com/watch?v=GUWZaODo_IM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=40) in [JCB](http://joomlacomponentbuilder.com).
|
||||
+ 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.
|
||||
@ -83,13 +83,13 @@ You are in Control
|
||||
+ 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](http://joomlacomponentbuilder.com) and import into another [JCB](http://joomlacomponentbuilder.com).
|
||||
+ 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](http://joomlacomponentbuilder.com) fully mapped can now be yours! Including many other [JCB](http://joomlacomponentbuilder.com) mapped components.
|
||||
> 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)!
|
||||
|
||||
@ -99,18 +99,22 @@ To install these packages [watch this tutorial](https://vdm.bz/how-to-install-jc
|
||||
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](http://joomlacomponentbuilder.com/report-security-issues)
|
||||
+ [Community Complaint](http://joomlacomponentbuilder.com/community-complaint)
|
||||
+ [Open Issue On Gitea](https://git.vdm.dev/joomla/Component-Builder/issues) ^^
|
||||
|
||||
Since [JCB](http://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.
|
||||
- [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).
|
||||
|
||||
@ -125,14 +129,14 @@ Our idea was to almost let this tool serve as a cheat sheet to how things can be
|
||||
MAKING IT BETTER!
|
||||
====================
|
||||
|
||||
Get involved on the forums, and the Gitea issues, and you can even help us develop/improve the pipeline of [JCB](http://joomlacomponentbuilder.com) for continues delivery. We really want to see [JCB](http://joomlacomponentbuilder.com) remain the tool of choice for all [Joomla Component Development](https://extensions.joomla.org/extension/component-builder/) needs and ideas.
|
||||
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](http://joomlacomponentbuilder.com).
|
||||
- Team collaborative development across [JCB](http://joomlacomponentbuilder.com) installations offline and online.
|
||||
- Documentation (maintained by the community) for [JCB](http://joomlacomponentbuilder.com). (help us select the best system for this)
|
||||
- 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
|
||||
|
||||
@ -140,16 +144,16 @@ TODO
|
||||
+ *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*: 20th September, 2022
|
||||
+ *Version*: 3.1.8
|
||||
+ *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*: **331607**
|
||||
+ *Field count*: **2004**
|
||||
+ *File count*: **2170**
|
||||
+ *Folder count*: **376**
|
||||
+ *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](http://joomlacomponentbuilder.com).
|
||||
> 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)
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
# Joomla Component Builder ([JCB](http://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)
|
||||
|
||||
@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
|
||||
|
||||
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.8) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
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)
|
||||
|
||||
@ -23,8 +23,8 @@ Some of the Features
|
||||
+ 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](http://joomlacomponentbuilder.com)
|
||||
+ [Automated backup system](https://www.youtube.com/watch?v=GUWZaODo_IM&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=0s&index=40) in [JCB](http://joomlacomponentbuilder.com).
|
||||
+ 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.
|
||||
@ -83,13 +83,13 @@ You are in Control
|
||||
+ 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](http://joomlacomponentbuilder.com) and import into another [JCB](http://joomlacomponentbuilder.com).
|
||||
+ 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](http://joomlacomponentbuilder.com) fully mapped can now be yours! Including many other [JCB](http://joomlacomponentbuilder.com) mapped components.
|
||||
> 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)!
|
||||
|
||||
@ -99,18 +99,22 @@ To install these packages [watch this tutorial](https://vdm.bz/how-to-install-jc
|
||||
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](http://joomlacomponentbuilder.com/report-security-issues)
|
||||
+ [Community Complaint](http://joomlacomponentbuilder.com/community-complaint)
|
||||
+ [Open Issue On Gitea](https://git.vdm.dev/joomla/Component-Builder/issues) ^^
|
||||
|
||||
Since [JCB](http://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.
|
||||
- [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).
|
||||
|
||||
@ -125,14 +129,14 @@ Our idea was to almost let this tool serve as a cheat sheet to how things can be
|
||||
MAKING IT BETTER!
|
||||
====================
|
||||
|
||||
Get involved on the forums, and the Gitea issues, and you can even help us develop/improve the pipeline of [JCB](http://joomlacomponentbuilder.com) for continues delivery. We really want to see [JCB](http://joomlacomponentbuilder.com) remain the tool of choice for all [Joomla Component Development](https://extensions.joomla.org/extension/component-builder/) needs and ideas.
|
||||
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](http://joomlacomponentbuilder.com).
|
||||
- Team collaborative development across [JCB](http://joomlacomponentbuilder.com) installations offline and online.
|
||||
- Documentation (maintained by the community) for [JCB](http://joomlacomponentbuilder.com). (help us select the best system for this)
|
||||
- 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
|
||||
|
||||
@ -140,16 +144,16 @@ TODO
|
||||
+ *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*: 20th September, 2022
|
||||
+ *Version*: 3.1.8
|
||||
+ *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*: **331607**
|
||||
+ *Field count*: **2004**
|
||||
+ *File count*: **2170**
|
||||
+ *Folder count*: **376**
|
||||
+ *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](http://joomlacomponentbuilder.com).
|
||||
> 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)
|
||||
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
<action name="admin_view.access" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_ACCESS" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_ACCESS_DESC" />
|
||||
<action name="admin_view.batch" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_BATCH_USE" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_BATCH_USE_DESC" />
|
||||
<action name="admin_view.create" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_CREATE" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_CREATE_DESC" />
|
||||
<action name="admin_view.dashboard_add" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_DASHBOARD_ADD_DESC" />
|
||||
<action name="admin_view.dashboard_list" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_DASHBOARD_LIST_DESC" />
|
||||
<action name="admin_view.delete" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_DELETE" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_DELETE_DESC" />
|
||||
<action name="admin_view.edit" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_DESC" />
|
||||
@ -235,7 +234,6 @@
|
||||
<action name="custom_admin_view.get_snippets" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_GET_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_GET_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="custom_admin_view.access" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_ACCESS" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_ACCESS_DESC" />
|
||||
<action name="custom_admin_view.batch" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_BATCH_USE" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_BATCH_USE_DESC" />
|
||||
<action name="custom_admin_view.dashboard_add" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_ADD_DESC" />
|
||||
<action name="custom_admin_view.dashboard_list" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_LIST_DESC" />
|
||||
<action name="custom_admin_view.version" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_VERSION_DESC" />
|
||||
<action name="custom_admin_view.export" title="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EXPORT" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EXPORT_DESC" />
|
||||
@ -485,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" />
|
||||
@ -500,6 +501,7 @@
|
||||
<action name="power.submenu" title="COM_COMPONENTBUILDER_POWERS_SUBMENU" description="COM_COMPONENTBUILDER_POWERS_SUBMENU_DESC" />
|
||||
<action name="search.access" title="COM_COMPONENTBUILDER_SEARCH_ACCESS" description="COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC" />
|
||||
<action name="search.compiler" title="COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS_DESC" />
|
||||
<action name="search.dashboard_list" title="COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST_DESC" />
|
||||
<action name="search.submenu" title="COM_COMPONENTBUILDER_SEARCH_SUBMENU" description="COM_COMPONENTBUILDER_SEARCH_SUBMENU_DESC" />
|
||||
<action name="server.access" title="COM_COMPONENTBUILDER_SERVERS_ACCESS" description="COM_COMPONENTBUILDER_SERVERS_ACCESS_DESC" />
|
||||
<action name="server.batch" title="COM_COMPONENTBUILDER_SERVERS_BATCH_USE" description="COM_COMPONENTBUILDER_SERVERS_BATCH_USE_DESC" />
|
||||
@ -518,7 +520,6 @@
|
||||
<action name="site_view.get_snippets" title="COM_COMPONENTBUILDER_SITE_VIEW_GET_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SITE_VIEW_GET_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="site_view.access" title="COM_COMPONENTBUILDER_SITE_VIEWS_ACCESS" description="COM_COMPONENTBUILDER_SITE_VIEWS_ACCESS_DESC" />
|
||||
<action name="site_view.batch" title="COM_COMPONENTBUILDER_SITE_VIEWS_BATCH_USE" description="COM_COMPONENTBUILDER_SITE_VIEWS_BATCH_USE_DESC" />
|
||||
<action name="site_view.dashboard_add" title="COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_ADD_DESC" />
|
||||
<action name="site_view.dashboard_list" title="COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_LIST_DESC" />
|
||||
<action name="site_view.version" title="COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION" description="COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_VERSION_DESC" />
|
||||
<action name="site_view.export" title="COM_COMPONENTBUILDER_SITE_VIEWS_EXPORT" description="COM_COMPONENTBUILDER_SITE_VIEWS_EXPORT_DESC" />
|
||||
|
@ -10,4 +10,31 @@
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
||||
.selected {
|
||||
background-color:#d7d8db !important
|
||||
}
|
||||
tr.selected td {
|
||||
background-color:#d7d8db !important
|
||||
}
|
||||
#search_settings_block .controls {
|
||||
margin-left: 1px !important;
|
||||
}
|
||||
tr {
|
||||
cursor:pointer
|
||||
}
|
||||
.found_code {
|
||||
color: #46a546;
|
||||
font-weight: bolder;
|
||||
}
|
||||
.search_details_title {
|
||||
font-size: large;
|
||||
font-weight: bolder;
|
||||
}
|
||||
.small_column {
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
}
|
||||
th.small_column {
|
||||
padding: 2px !important;
|
||||
text-align: center !important;
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
Binary file not shown.
Before Width: | Height: | Size: 23 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 34 KiB |
BIN
admin/assets/images/icons/search.png
Normal file
BIN
admin/assets/images/icons/search.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 21 KiB |
956
admin/assets/js/search.js
Normal file
956
admin/assets/js/search.js
Normal file
@ -0,0 +1,956 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
/* JS Document */
|
||||
/**
|
||||
* JS Function to execute the search
|
||||
*/
|
||||
const doSearch = async (signal, tables) => {
|
||||
try {
|
||||
// build form
|
||||
const formData = new FormData();
|
||||
|
||||
// load the result table
|
||||
const resultsTable = new DataTable('#search_results_table');
|
||||
|
||||
// get the search mode
|
||||
let typeSearch = modeObject.querySelector('input[type=\'radio\']:checked').value;
|
||||
|
||||
// set some search values
|
||||
let searchValue = searchObject.value;
|
||||
let replaceValue = replaceObject.value;
|
||||
let matchValue = matchObject.checked ? 1 : 0;
|
||||
let wholeValue = wholeObject.checked ? 1 : 0;
|
||||
let regexValue = regexObject.checked ? 1 : 0;
|
||||
|
||||
// add the form data
|
||||
formData.append('table_name', '');
|
||||
formData.append('type_search', typeSearch);
|
||||
formData.append('search_value', searchValue);
|
||||
formData.append('replace_value', replaceValue);
|
||||
formData.append('match_case', matchValue);
|
||||
formData.append('whole_word', wholeValue);
|
||||
formData.append('regex_search', regexValue);
|
||||
|
||||
// update the URL
|
||||
updateUrlQuery(searchValue, replaceValue, matchValue, wholeValue, regexValue, typeSearch);
|
||||
|
||||
let abort_this_search_values = false;
|
||||
|
||||
// reset the progress bar
|
||||
searchProgressBarObject.style.width = '0%';
|
||||
searchProgressBarObject.innerHTML = '0%';
|
||||
|
||||
// show the progress bar
|
||||
searchProgressObject.style.display = '';
|
||||
|
||||
// hidde the search button
|
||||
startSearchButton.style.display = 'none';
|
||||
|
||||
// show the stop search button
|
||||
stopSearchButton.style.display = '';
|
||||
|
||||
// start search timer
|
||||
startSearchTimer();
|
||||
|
||||
// reset our global counters
|
||||
fieldCount = 0;
|
||||
lineCount = 0;
|
||||
|
||||
// set our local counters
|
||||
let total = 0;
|
||||
let progress = tables.length;
|
||||
let index;
|
||||
|
||||
for (index = 0; index < progress; index++) {
|
||||
|
||||
let tableName = tables[index];
|
||||
|
||||
// add the table name
|
||||
formData.set('table_name', tableName);
|
||||
|
||||
let options = {
|
||||
signal: signal,
|
||||
method: 'POST', // *GET, POST, PUT, DELETE, etc.
|
||||
body: formData
|
||||
}
|
||||
|
||||
if (abort_this_search_values) {
|
||||
break;
|
||||
}
|
||||
const response = await fetch(UrlAjax + 'doSearch', options).then(response => {
|
||||
total++;
|
||||
// return the json response
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
} else {
|
||||
UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_THE_SEARCH_PROCESS_HAD_AN_ERROR_WITH_TABLE') + ' ' + tableName, {pos:'top-right', status:'danger'});
|
||||
}
|
||||
}).then((data) => {
|
||||
if (typeof data.success !== 'undefined') {
|
||||
UIkit.notify(data.success, {pos:'top-right', timeout : 200, status:'success'});
|
||||
//} else if (typeof data.not_found !== 'undefined') {
|
||||
// UIkit.notify(data.not_found, {pos:'bottom-right', timeout : 200});
|
||||
}
|
||||
if (typeof data.items !== 'undefined') {
|
||||
addTableItems(resultsTable, data.items, typeSearch);
|
||||
}
|
||||
if (typeof data.fields_count !== 'undefined') {
|
||||
fieldCount += data.fields_count;
|
||||
}
|
||||
if (typeof data.line_count !== 'undefined') {
|
||||
lineCount += data.line_count;
|
||||
}
|
||||
// calculate the percent
|
||||
let percent = 100.0 * (total / progress);
|
||||
// update the progress bar
|
||||
searchProgressObject.style.display = ''; // always make sure it still shows...
|
||||
searchProgressBarObject.style.width = percent.toFixed(2) + '%';
|
||||
searchProgressBarObject.innerHTML = percent.toFixed(2) + '%';
|
||||
// when complete hide the progress bar
|
||||
if (progress == total) {
|
||||
let total_field_line = ' ' + fieldCount + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_FIELDS_THAT_HAD') + ' ' + lineCount + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_LINES') + ' ';
|
||||
if (progress == 1) {
|
||||
searchProgressBarObject.innerHTML = Joomla.JText._('COM_COMPONENTBUILDER_SEARCHING') + ' ' + tableName + total_field_line + Joomla.JText._('COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN') + ' ' + getSearchLenght() + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_SECONDS');
|
||||
} else {
|
||||
searchProgressBarObject.innerHTML = Joomla.JText._('COM_COMPONENTBUILDER_SEARCHING') + ' ' + progress + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_TABLES_WITH') + total_field_line + Joomla.JText._('COM_COMPONENTBUILDER_AND_FINISHED_THE_SEARCH_IN') + ' ' + getSearchLenght() + ' ' + Joomla.JText._('COM_COMPONENTBUILDER_SECONDS');
|
||||
}
|
||||
// show the search button
|
||||
startSearchButton.style.display = '';
|
||||
// hidde the stop search button
|
||||
stopSearchButton.style.display = 'none';
|
||||
setTimeout(function () {
|
||||
// hide the progress bar again
|
||||
searchProgressObject.style.display = 'none';
|
||||
}, 13000);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
if (error.name === "AbortError") {
|
||||
abort_this_search_values = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
// Executed regardless if we caught the error
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* JS Function to start search timer
|
||||
*/
|
||||
const startSearchTimer = () => {
|
||||
startSearchTime = new Date();
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to get search lenght
|
||||
*/
|
||||
const getSearchLenght = () => {
|
||||
// set ending time
|
||||
endSearchTime = new Date();
|
||||
|
||||
// get diff in ms
|
||||
var timeDiff = endSearchTime - startSearchTime;
|
||||
|
||||
// strip the ms
|
||||
timeDiff /= 1000;
|
||||
|
||||
// get seconds
|
||||
return Math.round(timeDiff);
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to fetch selected item
|
||||
*/
|
||||
const getSelectedItem = async (table, row, field, line) => {
|
||||
try {
|
||||
// get the search mode
|
||||
let mode = modeObject.querySelector('input[type=\'radio\']:checked').value;
|
||||
|
||||
// build form
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append('field_name', field);
|
||||
formData.append('row_id', row);
|
||||
formData.append('table_name', table);
|
||||
formData.append('search_value', searchObject.value);
|
||||
formData.append('replace_value', replaceObject.value);
|
||||
formData.append('match_case', matchObject.checked ? 1 : 0);
|
||||
formData.append('whole_word', wholeObject.checked ? 1 : 0);
|
||||
formData.append('regex_search', regexObject.checked ? 1 : 0);
|
||||
|
||||
// get search value
|
||||
if (mode == 2) {
|
||||
// add the line value
|
||||
formData.append('line_nr', line);
|
||||
// calling URL
|
||||
postURL = UrlAjax + 'getReplaceValue';
|
||||
} else {
|
||||
// calling URL
|
||||
postURL = UrlAjax + 'getSearchValue';
|
||||
}
|
||||
|
||||
let options = {
|
||||
method: 'POST', // *GET, POST, PUT, DELETE, etc.
|
||||
body: formData
|
||||
}
|
||||
|
||||
const response = await fetch(postURL, options).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
}).then((data) => {
|
||||
if (typeof data.success !== 'undefined') {
|
||||
UIkit.notify(data.success, {pos:'top-right', status:'success'});
|
||||
}
|
||||
if (typeof data.value !== 'undefined') {
|
||||
addSelectedItem(data.value, table, row, field, line);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
// Executed regardless if we caught the error
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to check if we should save/update the all current found items
|
||||
*/
|
||||
const replaceAllCheck = () => {
|
||||
// get the current searc and replace values
|
||||
let searchValue = searchObject.value;
|
||||
let replaceValue = replaceObject.value;
|
||||
// load question
|
||||
let question = Joomla.JText._('COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_BALLB_VALUES_THAT_CAN_BE_FOUND_IN_THE_DATABASE') + '<br />' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_YOU_WILL_REPLACE') + ': [<span class="found_code">' + htmlentities(searchValue) + '</span>] ' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_WITH') + ': [<span class="found_code">' + htmlentities(replaceValue) + '</span>]<br />' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_BYOU_HAVE_BEEN_WARNEDB') + '<br /><br />' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_ARE_YOU_THEREFORE_ABSOLUTELY_SURE_YOU_WANT_TO_CONTINUE');
|
||||
// do check
|
||||
UIkit.modal.confirm(question, function () {
|
||||
|
||||
// show the search settings again
|
||||
showSearch();
|
||||
|
||||
// Create new controller and issue new request
|
||||
controller_replace = new AbortController();
|
||||
|
||||
// check if any specific table was set
|
||||
let tables = [];
|
||||
let table = tableObject.value;
|
||||
if (table != -1) {
|
||||
tables.push(table);
|
||||
replaceAll(controller_replace.signal, tables);
|
||||
} else {
|
||||
replaceAll(controller_replace.signal, searchTables);
|
||||
}
|
||||
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES_UPDATE_ALL'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to execute the search
|
||||
*/
|
||||
const replaceAll = async (signal, tables) => {
|
||||
try {
|
||||
// build form
|
||||
const formData = new FormData();
|
||||
|
||||
// get the search mode
|
||||
let typeSearch = modeObject.querySelector('input[type=\'radio\']:checked').value;
|
||||
|
||||
// set some search values
|
||||
let searchValue = searchObject.value;
|
||||
let replaceValue = replaceObject.value;
|
||||
let matchValue = matchObject.checked ? 1 : 0;
|
||||
let wholeValue = wholeObject.checked ? 1 : 0;
|
||||
let regexValue = regexObject.checked ? 1 : 0;
|
||||
|
||||
// add the form data
|
||||
formData.append('table_name', '');
|
||||
formData.append('type_search', typeSearch);
|
||||
formData.append('search_value', searchValue);
|
||||
formData.append('replace_value', replaceValue);
|
||||
formData.append('match_case', matchValue);
|
||||
formData.append('whole_word', wholeValue);
|
||||
formData.append('regex_search', regexValue);
|
||||
|
||||
// reset the progress bar
|
||||
replaceProgressBarObject.style.width = '0%';
|
||||
|
||||
// show the progress bar
|
||||
replaceProgressObject.style.display = '';
|
||||
|
||||
let abort_this_replace_values = false;
|
||||
|
||||
let total = 0;
|
||||
let progress = tables.length;
|
||||
let index;
|
||||
|
||||
for (index = 0; index < progress; index++) {
|
||||
|
||||
let tableName = tables[index];
|
||||
|
||||
// add the table name
|
||||
formData.set('table_name', tableName);
|
||||
|
||||
let options = {
|
||||
signal: signal,
|
||||
method: 'POST', // *GET, POST, PUT, DELETE, etc.
|
||||
body: formData
|
||||
}
|
||||
|
||||
if (abort_this_replace_values) {
|
||||
break;
|
||||
}
|
||||
const response = await fetch(UrlAjax + 'replaceAll', options).then(response => {
|
||||
total++;
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
} else {
|
||||
UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_THE_REPLACE_PROCESS_HAD_AN_ERROR_WITH_TABLE') + ' ' + tableName, {pos:'top-right', status:'danger'});
|
||||
}
|
||||
}).then((data) => {
|
||||
if (typeof data.success !== 'undefined') {
|
||||
UIkit.notify(data.success, {pos:'top-right', timeout : 200, status:'success'});
|
||||
} else if (typeof data.error !== 'undefined') {
|
||||
UIkit.notify(data.error, {pos:'bottom-right', timeout : 200});
|
||||
}
|
||||
// calculate the percent
|
||||
let percent = 100.0 * (total / progress);
|
||||
// update the progress bar
|
||||
replaceProgressBarObject.style.width = percent.toFixed(2) + '%';
|
||||
// when complete hide the progress bar
|
||||
if (progress == total) {
|
||||
setTimeout(function () {
|
||||
// hide the progress bar again
|
||||
replaceProgressObject.style.display = 'none';
|
||||
// we clear the table again
|
||||
clearAll();
|
||||
// if not reqex we reverse the search for you so you can see the update was a success
|
||||
if (regexValue == 0) {
|
||||
// set the replace value as the search value
|
||||
UIkit.modal.confirm(Joomla.JText._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_DO_A_REVERSE_SEARCH'), function(){
|
||||
startNewSearch(replaceValue, searchValue, matchValue, wholeValue, regexValue, 2);
|
||||
}, function () {
|
||||
UIkit.modal.confirm(Joomla.JText._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH'), function(){
|
||||
startSearch();
|
||||
}, function () {
|
||||
clearSearch();
|
||||
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
|
||||
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
|
||||
} else {
|
||||
// else we search it again just to prove its changed
|
||||
UIkit.modal.confirm(Joomla.JText._('COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_REPEAT_THE_SAME_SEARCH'), function(){
|
||||
startSearch();
|
||||
}, function () {
|
||||
clearSearch();
|
||||
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
if (error.name === "AbortError") {
|
||||
abort_this_replace_values = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
// Executed regardless if we caught the error
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to check if we should save/update the current selected item
|
||||
*/
|
||||
const setValueCheck = (row, field, table) => {
|
||||
// load question
|
||||
let question = Joomla.JText._('COM_COMPONENTBUILDER_YOUR_ARE_ABOUT_TO_UPDATE_ROW') + ' (' + row + ') -> (' + field + ') ' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_FIELD_IN_THE') + ' (' + table + ') ' + Joomla.JText._('COM_COMPONENTBUILDER_TABLE') + '.<br /><br />' +
|
||||
Joomla.JText._('COM_COMPONENTBUILDER_THIS_CAN_NOT_BE_UNDONE_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE');
|
||||
// do check
|
||||
UIkit.modal.confirm(question, function () {
|
||||
setValue(row, field, table);
|
||||
}, {labels: { Ok: Joomla.JText._('COM_COMPONENTBUILDER_YES'), Cancel: Joomla.JText._('COM_COMPONENTBUILDER_NO') }});
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to set the current selected item
|
||||
*/
|
||||
const setValue = async (row, field, table) => {
|
||||
try {
|
||||
// get the value from the editor
|
||||
let value = editorObject.getValue();
|
||||
|
||||
// build form
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append('value', value);
|
||||
formData.append('row_id', row);
|
||||
formData.append('field_name', field);
|
||||
formData.append('table_name', table);
|
||||
|
||||
let options = {
|
||||
method: 'POST', // *GET, POST, PUT, DELETE, etc.
|
||||
body: formData
|
||||
}
|
||||
|
||||
const response = await fetch(UrlAjax + 'setValue', options).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
}).then((data) => {
|
||||
if (typeof data.success !== 'undefined') {
|
||||
UIkit.notify(data.success, {pos:'top-right', status:'success'});
|
||||
clearSelectedItem();
|
||||
tableActiveObject.remove().draw();
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
// Executed regardless if we caught the error
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to add item to the editor
|
||||
*/
|
||||
const addSelectedItem = async (value, table, row, field, line) => {
|
||||
// display area
|
||||
if (value.length > 1)
|
||||
{
|
||||
// add value to editor
|
||||
editorObject.setValue(value);
|
||||
|
||||
// set item details notice area
|
||||
itemNoticeObject.style.display = '';
|
||||
itemEditButtonObject.innerHTML = editButtonSelected;
|
||||
itemTableNameObject.innerHTML = table;
|
||||
itemRowIdObject.innerHTML = row;
|
||||
itemFieldNameObject.innerHTML = field;
|
||||
itemLineNumberObject.innerHTML = line;
|
||||
// set button and editor line if we have a line number
|
||||
if (typeof line == 'number') {
|
||||
// show and set the save button
|
||||
buttonUpdateItemObject.style.display = '';
|
||||
buttonUpdateItemObject.setAttribute('onclick',"setValueCheck(" + row + ", '" + field + "', '" + table + "');");
|
||||
|
||||
// get top of the code line
|
||||
let top = editorObject.charCoords({line: line, ch: 0}, "local").top;
|
||||
// scroll to the line
|
||||
editorObject.scrollTo(null, top - 12);
|
||||
// select the line
|
||||
editorObject.setCursor(line - 1);
|
||||
} else {
|
||||
// no line so no data we can't save this data
|
||||
buttonUpdateItemObject.setAttribute('onclick', "");
|
||||
buttonUpdateItemObject.style.display = 'none';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to clear item from the editor and hide it
|
||||
*/
|
||||
const clearSelectedItem = async () => {
|
||||
// display area
|
||||
editorObject.setValue('');
|
||||
// clear notice area
|
||||
itemNoticeObject.style.display = 'none';
|
||||
itemEditButtonObject.innerHTML = '...';
|
||||
itemTableNameObject.innerHTML = '...';
|
||||
itemRowIdObject.innerHTML = '...';
|
||||
itemFieldNameObject.innerHTML = '...';
|
||||
itemLineNumberObject.innerHTML = '...';
|
||||
// clear update button
|
||||
buttonUpdateItemObject.setAttribute('onclick', '');
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to clear table items
|
||||
*/
|
||||
const clearTableItems = async () => {
|
||||
let table = new DataTable('#search_results_table');
|
||||
// clear search
|
||||
table.search('').columns().search( '' );
|
||||
// clear items
|
||||
table.clear().draw( true );
|
||||
|
||||
// hide the update all items
|
||||
buttonUpdateAllStyleDisplay('none');
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to clear all details of the search
|
||||
*/
|
||||
const clearAll = async () => {
|
||||
// clear all details
|
||||
clearTableItems();
|
||||
clearSelectedItem();
|
||||
searchedObject.innerHTML = '....';
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to clear the search and replace values
|
||||
*/
|
||||
const clearSearch = async () => {
|
||||
// clear the search and replace values
|
||||
searchObject.value = '';
|
||||
replaceObject.value = '';
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to set the search and replace values
|
||||
*/
|
||||
const startNewSearch = async (search, replace = '', match = 0, whole = 0, regex = 0, mode = 1) => {
|
||||
// redirect to a new search
|
||||
window.location.href = getSearchURL(search, replace, match, whole, regex, mode);
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to update the URL of the browser with the search query
|
||||
*/
|
||||
const updateUrlQuery = async (search, replace = '', match = 0, whole = 0, regex = 0, mode = 1) => {
|
||||
// update the url query
|
||||
window.history.pushState({}, '', getSearchURL(search, replace, match, whole, regex, mode));
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to get the current search URL
|
||||
*/
|
||||
const getSearchURL = (search, replace = '', match = 0, whole = 0, regex = 0, mode = 1) => {
|
||||
// check if its a single table search
|
||||
let table = tableObject.value;
|
||||
let table_name = '';
|
||||
if (table != -1) {
|
||||
table_name = '&table_name=' + urlencode(table);
|
||||
}
|
||||
// update the type of search
|
||||
if (mode == 1) {
|
||||
return UrlSearch + table_name +
|
||||
'&search_value=' + urlencode(search) +
|
||||
'&type_search=1&match_case=' + match +
|
||||
'&whole_word=' + whole +
|
||||
'®ex_search=' + regex;
|
||||
} else if (mode == 2) {
|
||||
return UrlSearch + table_name +
|
||||
'&search_value=' + urlencode(search) +
|
||||
'&replace_value=' + urlencode(replace) +
|
||||
'&type_search=2&match_case=' + match +
|
||||
'&whole_word=' + whole +
|
||||
'®ex_search=' + regex;
|
||||
}
|
||||
return UrlSearch + table_name;
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to check if a element has a class
|
||||
*/
|
||||
const hasClass = (elementObject, classNaam) => {
|
||||
return !!elementObject.className.match(new RegExp('(\\s|^)' + classNaam + '(\\s|$)'));
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function add a class from an element
|
||||
*/
|
||||
const addClass = (elementObject, classNaam) => {
|
||||
if (!hasClass(elementObject, classNaam)) {
|
||||
elementObject.className += " " + classNaam;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function remove a class from an element
|
||||
*/
|
||||
const removeClass = (elementObject, classNaam) => {
|
||||
if (hasClass(elementObject, classNaam)) {
|
||||
var reg = new RegExp('(\\s|^)' + classNaam + '(\\s|$)');
|
||||
elementObject.className = elementObject.className.replace(reg, ' ');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to add items to the table
|
||||
*/
|
||||
const addTableItems = async (table, items, typeSearch) => {
|
||||
table.rows.add(items).draw( false );
|
||||
if (typeSearch == 2) {
|
||||
buttonUpdateAllStyleDisplay(''); // TODO should only show once all items are loaded
|
||||
} else {
|
||||
buttonUpdateAllStyleDisplay('none'); // TODO should only show once all items are loaded
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to update the update all button
|
||||
*/
|
||||
const buttonUpdateAllStyleDisplay = async (value) => {
|
||||
buttonUpdateAllObject.forEach((buttonObject) => {
|
||||
buttonObject.style.display = value;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to execute (A) on search/replace text change , (B) on search options changes
|
||||
*/
|
||||
const startSearch = (field, forced = false) => {
|
||||
// check mode
|
||||
let mode = modeObject.querySelector('input[type=\'radio\']:checked').value;
|
||||
if (mode == 0) {
|
||||
// reset the search area
|
||||
window.location.href = UrlSearch;
|
||||
}
|
||||
// check if we have an Enter click
|
||||
if (field && typeof field.code !== 'undefined' && field.code === "Enter") {
|
||||
forced = true;
|
||||
}
|
||||
// get replace value if set
|
||||
const replaceValue = replaceObject.value;
|
||||
if (replaceValue.length > 0) {
|
||||
// set the searched value
|
||||
replacedObject.innerHTML = htmlentities(replaceValue);
|
||||
} else {
|
||||
replacedObject.innerHTML = '';
|
||||
}
|
||||
// get search value
|
||||
const searchValue = searchObject.value;
|
||||
if (searchValue.length > 2 || (searchValue.length > 0 && forced)) {
|
||||
// Cancel any ongoing requests
|
||||
if (controller) controller.abort();
|
||||
|
||||
// we clear the table again
|
||||
clearAll();
|
||||
|
||||
// set the searched value
|
||||
searchedObject.innerHTML = htmlentities(searchValue);
|
||||
|
||||
// Create new controller and issue new request
|
||||
controller = new AbortController();
|
||||
|
||||
// check if any specific table was set
|
||||
let tables = [];
|
||||
let table = tableObject.value;
|
||||
if (table != -1) {
|
||||
tables.push(table);
|
||||
doSearch(controller.signal, tables);
|
||||
} else {
|
||||
doSearch(controller.signal, searchTables);
|
||||
}
|
||||
} else {
|
||||
// Clear the table
|
||||
clearAll();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to stop a search
|
||||
*/
|
||||
const stopSearch = () => {
|
||||
// Cancel any ongoing requests
|
||||
if (controller) controller.abort();
|
||||
// show the search button
|
||||
startSearchButton.style.display = '';
|
||||
// hidde the stop search button
|
||||
stopSearchButton.style.display = 'none';
|
||||
// remove the progress bar at some point
|
||||
setTimeout(function () {
|
||||
// hide the progress bar again
|
||||
searchProgressObject.style.display = 'none';
|
||||
}, 13000);
|
||||
}
|
||||
|
||||
/**
|
||||
* JS Function to hide search settings and show table search
|
||||
*/
|
||||
const showSearch = () => {
|
||||
searchSettingsObject.style.display = '';
|
||||
searchDetailsObject.style.display = 'none';
|
||||
replaceDetailsObject.style.display = 'none';
|
||||
tableSearchObject.style.display = 'none';
|
||||
tableLengthObject.style.display = 'none';
|
||||
};
|
||||
|
||||
/**
|
||||
* JS Function to show search settings and hide table search
|
||||
*/
|
||||
const hideSearch = () => {
|
||||
searchSettingsObject.style.display = 'none';
|
||||
searchDetailsObject.style.display = '';
|
||||
tableSearchObject.style.display = '';
|
||||
tableLengthObject.style.display = '';
|
||||
// check if we are in replace mode
|
||||
let mode = modeObject.querySelector('input[type=\'radio\']:checked').value;
|
||||
if (mode == 2) {
|
||||
replaceDetailsObject.style.display = '';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function htmlentities(string, quoteStyle, charset, doubleEncode) {
|
||||
// discuss at: https://locutus.io/php/htmlentities/
|
||||
// original by: Kevin van Zonneveld (https://kvz.io)
|
||||
// revised by: Kevin van Zonneveld (https://kvz.io)
|
||||
// revised by: Kevin van Zonneveld (https://kvz.io)
|
||||
// improved by: nobbler
|
||||
// improved by: Jack
|
||||
// improved by: Rafał Kukawski (https://blog.kukawski.pl)
|
||||
// improved by: Dj (https://locutus.io/php/htmlentities:425#comment_134018)
|
||||
// bugfixed by: Onno Marsman (https://twitter.com/onnomarsman)
|
||||
// bugfixed by: Brett Zamir (https://brett-zamir.me)
|
||||
// input by: Ratheous
|
||||
// note 1: function is compatible with PHP 5.2 and older
|
||||
// example 1: htmlentities('Kevin & van Zonneveld')
|
||||
// returns 1: 'Kevin & van Zonneveld'
|
||||
// example 2: htmlentities("foo'bar","ENT_QUOTES")
|
||||
// returns 2: 'foo'bar'
|
||||
const hashMap = getHtmlTranslationTable('HTML_ENTITIES', quoteStyle)
|
||||
string = string === null ? '' : string + ''
|
||||
if (!hashMap) {
|
||||
return false
|
||||
}
|
||||
if (quoteStyle && quoteStyle === 'ENT_QUOTES') {
|
||||
hashMap["'"] = '''
|
||||
}
|
||||
doubleEncode = doubleEncode === null || !!doubleEncode
|
||||
const regex = new RegExp('&(?:#\\d+|#x[\\da-f]+|[a-zA-Z][\\da-z]*);|[' +
|
||||
Object.keys(hashMap)
|
||||
.join('')
|
||||
// replace regexp special chars
|
||||
.replace(/([()[\]{}\-.*+?^$|/\\])/g, '\\$1') + ']',
|
||||
'g')
|
||||
return string.replace(regex, function (ent) {
|
||||
if (ent.length > 1) {
|
||||
return doubleEncode ? hashMap['&'] + ent.substr(1) : ent
|
||||
}
|
||||
return hashMap[ent]
|
||||
})
|
||||
}
|
||||
|
||||
function getHtmlTranslationTable(table, quoteStyle) { // eslint-disable-line camelcase
|
||||
// discuss at: https://locutus.io/php/get_html_translation_table/
|
||||
// original by: Philip Peterson
|
||||
// revised by: Kevin van Zonneveld (https://kvz.io)
|
||||
// bugfixed by: noname
|
||||
// bugfixed by: Alex
|
||||
// bugfixed by: Marco
|
||||
// bugfixed by: madipta
|
||||
// bugfixed by: Brett Zamir (https://brett-zamir.me)
|
||||
// bugfixed by: T.Wild
|
||||
// improved by: KELAN
|
||||
// improved by: Brett Zamir (https://brett-zamir.me)
|
||||
// input by: Frank Forte
|
||||
// input by: Ratheous
|
||||
// note 1: It has been decided that we're not going to add global
|
||||
// note 1: dependencies to Locutus, meaning the constants are not
|
||||
// note 1: real constants, but strings instead. Integers are also supported if someone
|
||||
// note 1: chooses to create the constants themselves.
|
||||
// example 1: get_html_translation_table('HTML_SPECIALCHARS')
|
||||
// returns 1: {'"': '"', '&': '&', '<': '<', '>': '>'}
|
||||
|
||||
const entities = {}
|
||||
const hashMap = {}
|
||||
let decimal
|
||||
const constMappingTable = {}
|
||||
const constMappingQuoteStyle = {}
|
||||
let useTable = {}
|
||||
let useQuoteStyle = {}
|
||||
|
||||
// Translate arguments
|
||||
constMappingTable[0] = 'HTML_SPECIALCHARS'
|
||||
constMappingTable[1] = 'HTML_ENTITIES'
|
||||
constMappingQuoteStyle[0] = 'ENT_NOQUOTES'
|
||||
constMappingQuoteStyle[2] = 'ENT_COMPAT'
|
||||
constMappingQuoteStyle[3] = 'ENT_QUOTES'
|
||||
|
||||
useTable = !isNaN(table)
|
||||
? constMappingTable[table]
|
||||
: table
|
||||
? table.toUpperCase()
|
||||
: 'HTML_SPECIALCHARS'
|
||||
|
||||
useQuoteStyle = !isNaN(quoteStyle)
|
||||
? constMappingQuoteStyle[quoteStyle]
|
||||
: quoteStyle
|
||||
? quoteStyle.toUpperCase()
|
||||
: 'ENT_COMPAT'
|
||||
|
||||
if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
|
||||
throw new Error('Table: ' + useTable + ' not supported')
|
||||
}
|
||||
|
||||
entities['38'] = '&'
|
||||
if (useTable === 'HTML_ENTITIES') {
|
||||
entities['160'] = ' '
|
||||
entities['161'] = '¡'
|
||||
entities['162'] = '¢'
|
||||
entities['163'] = '£'
|
||||
entities['164'] = '¤'
|
||||
entities['165'] = '¥'
|
||||
entities['166'] = '¦'
|
||||
entities['167'] = '§'
|
||||
entities['168'] = '¨'
|
||||
entities['169'] = '©'
|
||||
entities['170'] = 'ª'
|
||||
entities['171'] = '«'
|
||||
entities['172'] = '¬'
|
||||
entities['173'] = '­'
|
||||
entities['174'] = '®'
|
||||
entities['175'] = '¯'
|
||||
entities['176'] = '°'
|
||||
entities['177'] = '±'
|
||||
entities['178'] = '²'
|
||||
entities['179'] = '³'
|
||||
entities['180'] = '´'
|
||||
entities['181'] = 'µ'
|
||||
entities['182'] = '¶'
|
||||
entities['183'] = '·'
|
||||
entities['184'] = '¸'
|
||||
entities['185'] = '¹'
|
||||
entities['186'] = 'º'
|
||||
entities['187'] = '»'
|
||||
entities['188'] = '¼'
|
||||
entities['189'] = '½'
|
||||
entities['190'] = '¾'
|
||||
entities['191'] = '¿'
|
||||
entities['192'] = 'À'
|
||||
entities['193'] = 'Á'
|
||||
entities['194'] = 'Â'
|
||||
entities['195'] = 'Ã'
|
||||
entities['196'] = 'Ä'
|
||||
entities['197'] = 'Å'
|
||||
entities['198'] = 'Æ'
|
||||
entities['199'] = 'Ç'
|
||||
entities['200'] = 'È'
|
||||
entities['201'] = 'É'
|
||||
entities['202'] = 'Ê'
|
||||
entities['203'] = 'Ë'
|
||||
entities['204'] = 'Ì'
|
||||
entities['205'] = 'Í'
|
||||
entities['206'] = 'Î'
|
||||
entities['207'] = 'Ï'
|
||||
entities['208'] = 'Ð'
|
||||
entities['209'] = 'Ñ'
|
||||
entities['210'] = 'Ò'
|
||||
entities['211'] = 'Ó'
|
||||
entities['212'] = 'Ô'
|
||||
entities['213'] = 'Õ'
|
||||
entities['214'] = 'Ö'
|
||||
entities['215'] = '×'
|
||||
entities['216'] = 'Ø'
|
||||
entities['217'] = 'Ù'
|
||||
entities['218'] = 'Ú'
|
||||
entities['219'] = 'Û'
|
||||
entities['220'] = 'Ü'
|
||||
entities['221'] = 'Ý'
|
||||
entities['222'] = 'Þ'
|
||||
entities['223'] = 'ß'
|
||||
entities['224'] = 'à'
|
||||
entities['225'] = 'á'
|
||||
entities['226'] = 'â'
|
||||
entities['227'] = 'ã'
|
||||
entities['228'] = 'ä'
|
||||
entities['229'] = 'å'
|
||||
entities['230'] = 'æ'
|
||||
entities['231'] = 'ç'
|
||||
entities['232'] = 'è'
|
||||
entities['233'] = 'é'
|
||||
entities['234'] = 'ê'
|
||||
entities['235'] = 'ë'
|
||||
entities['236'] = 'ì'
|
||||
entities['237'] = 'í'
|
||||
entities['238'] = 'î'
|
||||
entities['239'] = 'ï'
|
||||
entities['240'] = 'ð'
|
||||
entities['241'] = 'ñ'
|
||||
entities['242'] = 'ò'
|
||||
entities['243'] = 'ó'
|
||||
entities['244'] = 'ô'
|
||||
entities['245'] = 'õ'
|
||||
entities['246'] = 'ö'
|
||||
entities['247'] = '÷'
|
||||
entities['248'] = 'ø'
|
||||
entities['249'] = 'ù'
|
||||
entities['250'] = 'ú'
|
||||
entities['251'] = 'û'
|
||||
entities['252'] = 'ü'
|
||||
entities['253'] = 'ý'
|
||||
entities['254'] = 'þ'
|
||||
entities['255'] = 'ÿ'
|
||||
}
|
||||
|
||||
if (useQuoteStyle !== 'ENT_NOQUOTES') {
|
||||
entities['34'] = '"'
|
||||
}
|
||||
if (useQuoteStyle === 'ENT_QUOTES') {
|
||||
entities['39'] = '''
|
||||
}
|
||||
entities['60'] = '<'
|
||||
entities['62'] = '>'
|
||||
|
||||
// ascii decimals to real symbols
|
||||
for (decimal in entities) {
|
||||
if (entities.hasOwnProperty(decimal)) {
|
||||
hashMap[String.fromCharCode(decimal)] = entities[decimal]
|
||||
}
|
||||
}
|
||||
|
||||
return hashMap
|
||||
}
|
||||
|
||||
|
||||
function urlencode (str) {
|
||||
// discuss at: https://locutus.io/php/urlencode/
|
||||
// original by: Philip Peterson
|
||||
// improved by: Kevin van Zonneveld (https://kvz.io)
|
||||
// improved by: Kevin van Zonneveld (https://kvz.io)
|
||||
// improved by: Brett Zamir (https://brett-zamir.me)
|
||||
// improved by: Lars Fischer
|
||||
// improved by: Waldo Malqui Silva (https://fayr.us/waldo/)
|
||||
// input by: AJ
|
||||
// input by: travc
|
||||
// input by: Brett Zamir (https://brett-zamir.me)
|
||||
// input by: Ratheous
|
||||
// bugfixed by: Kevin van Zonneveld (https://kvz.io)
|
||||
// bugfixed by: Kevin van Zonneveld (https://kvz.io)
|
||||
// bugfixed by: Joris
|
||||
// reimplemented by: Brett Zamir (https://brett-zamir.me)
|
||||
// reimplemented by: Brett Zamir (https://brett-zamir.me)
|
||||
// note 1: This reflects PHP 5.3/6.0+ behavior
|
||||
// note 1: Please be aware that this function
|
||||
// note 1: expects to encode into UTF-8 encoded strings, as found on
|
||||
// note 1: pages served as UTF-8
|
||||
// example 1: urlencode('Kevin van Zonneveld!')
|
||||
// returns 1: 'Kevin+van+Zonneveld%21'
|
||||
// example 2: urlencode('https://kvz.io/')
|
||||
// returns 2: 'https%3A%2F%2Fkvz.io%2F'
|
||||
// example 3: urlencode('https://www.google.nl/search?q=Locutus&ie=utf-8')
|
||||
// returns 3: 'https%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3DLocutus%26ie%3Dutf-8'
|
||||
str = (str + '')
|
||||
return encodeURIComponent(str)
|
||||
.replace(/!/g, '%21')
|
||||
.replace(/'/g, '%27')
|
||||
.replace(/\(/g, '%28')
|
||||
.replace(/\)/g, '%29')
|
||||
.replace(/\*/g, '%2A')
|
||||
.replace(/~/g, '%7E')
|
||||
.replace(/%20/g, '+')
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
1
admin/compiler/joomla_3/CHANGELOG.md
Normal file
1
admin/compiler/joomla_3/CHANGELOG.md
Normal file
@ -0,0 +1 @@
|
||||
###CHANGELOG###
|
@ -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",
|
||||
|
@ -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",
|
||||
|
196
admin/config.xml
196
admin/config.xml
@ -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">
|
||||
|
@ -67,8 +67,11 @@ class ComponentbuilderControllerAjax extends BaseController
|
||||
$this->registerTask('fieldTypeProperties', 'ajax');
|
||||
$this->registerTask('getFieldPropertyDesc', 'ajax');
|
||||
$this->registerTask('getCodeGlueOptions', 'ajax');
|
||||
$this->registerTask('searchTable', 'ajax');
|
||||
$this->registerTask('updateTable', 'ajax');
|
||||
$this->registerTask('doSearch', 'ajax');
|
||||
$this->registerTask('replaceAll', 'ajax');
|
||||
$this->registerTask('getSearchValue', 'ajax');
|
||||
$this->registerTask('getReplaceValue', 'ajax');
|
||||
$this->registerTask('setValue', 'ajax');
|
||||
$this->registerTask('snippetDetails', 'ajax');
|
||||
$this->registerTask('setSnippetGithub', 'ajax');
|
||||
$this->registerTask('getSnippets', 'ajax');
|
||||
@ -1633,18 +1636,19 @@ class ComponentbuilderControllerAjax extends BaseController
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'searchTable':
|
||||
case 'doSearch':
|
||||
try
|
||||
{
|
||||
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
||||
$type_searchValue = $jinput->get('type_search', 1, 'INT');
|
||||
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
|
||||
$match_caseValue = $jinput->get('match_case', 0, 'INT');
|
||||
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
|
||||
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
|
||||
$component_idValue = $jinput->get('component_id', 0, 'INT');
|
||||
if($table_nameValue && $user->id != 0 && $search_valueValue)
|
||||
if($table_nameValue && $user->id != 0 && $type_searchValue && $search_valueValue)
|
||||
{
|
||||
$result = $this->getModel('ajax')->searchTable($table_nameValue, $search_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
|
||||
$result = $this->getModel('ajax')->doSearch($table_nameValue, $type_searchValue, $search_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1679,7 +1683,7 @@ class ComponentbuilderControllerAjax extends BaseController
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'updateTable':
|
||||
case 'replaceAll':
|
||||
try
|
||||
{
|
||||
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
||||
@ -1691,7 +1695,148 @@ class ComponentbuilderControllerAjax extends BaseController
|
||||
$component_idValue = $jinput->get('component_id', 0, 'INT');
|
||||
if($table_nameValue && $user->id != 0 && $search_valueValue)
|
||||
{
|
||||
$result = $this->getModel('ajax')->updateTable($table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
|
||||
$result = $this->getModel('ajax')->replaceAll($table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue, $component_idValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback)
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getSearchValue':
|
||||
try
|
||||
{
|
||||
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
|
||||
$row_idValue = $jinput->get('row_id', NULL, 'INT');
|
||||
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
||||
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
|
||||
$replace_valueValue = $jinput->get('replace_value', NULL, 'RAW');
|
||||
$match_caseValue = $jinput->get('match_case', 0, 'INT');
|
||||
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
|
||||
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
|
||||
if($field_nameValue && $user->id != 0 && $row_idValue && $table_nameValue && $search_valueValue)
|
||||
{
|
||||
$result = $this->getModel('ajax')->getSearchValue($field_nameValue, $row_idValue, $table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback)
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getReplaceValue':
|
||||
try
|
||||
{
|
||||
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
|
||||
$row_idValue = $jinput->get('row_id', NULL, 'INT');
|
||||
$line_nrValue = $jinput->get('line_nr', 0, 'STRING');
|
||||
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
||||
$search_valueValue = $jinput->get('search_value', NULL, 'RAW');
|
||||
$replace_valueValue = $jinput->get('replace_value', NULL, 'RAW');
|
||||
$match_caseValue = $jinput->get('match_case', 0, 'INT');
|
||||
$whole_wordValue = $jinput->get('whole_word', 0, 'INT');
|
||||
$regex_searchValue = $jinput->get('regex_search', 0, 'INT');
|
||||
if($field_nameValue && $user->id != 0 && $row_idValue && $table_nameValue && $search_valueValue)
|
||||
{
|
||||
$result = $this->getModel('ajax')->getReplaceValue($field_nameValue, $row_idValue, $line_nrValue, $table_nameValue, $search_valueValue, $replace_valueValue, $match_caseValue, $whole_wordValue, $regex_searchValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback)
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback)
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'setValue':
|
||||
try
|
||||
{
|
||||
$valueValue = $jinput->get('value', NULL, 'RAW');
|
||||
$row_idValue = $jinput->get('row_id', NULL, 'INT');
|
||||
$field_nameValue = $jinput->get('field_name', NULL, 'WORD');
|
||||
$table_nameValue = $jinput->get('table_name', NULL, 'WORD');
|
||||
if($valueValue && $user->id != 0 && $row_idValue && $field_nameValue && $table_nameValue)
|
||||
{
|
||||
$result = $this->getModel('ajax')->setValue($valueValue, $row_idValue, $field_nameValue, $table_nameValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ class ComponentbuilderControllerCompiler extends AdminController
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
public function getCompilerAnimations()
|
||||
public function getDynamicContent()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
@ -65,7 +65,7 @@ class ComponentbuilderControllerCompiler extends AdminController
|
||||
{
|
||||
// get the model
|
||||
$model = $this->getModel('compiler');
|
||||
if ($model->getCompilerAnimations($message))
|
||||
if ($model->getDynamicContent($message))
|
||||
{
|
||||
$message = JText::_('COM_COMPONENTBUILDER_BALL_THE_COMPILER_ANIMATIONS_WERE_SUCCESSFULLY_DOWNLOADED_TO_THIS_JOOMLA_INSTALLB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
@ -171,19 +171,19 @@ class ComponentbuilderControllerCompiler extends AdminController
|
||||
}
|
||||
$message[] = '<h2>Total time saved</h2>';
|
||||
$message[] = '<ul>';
|
||||
$message[] = '<li>Total folders created: <b>'.$model->compiler->folderCount.'</b></li>';
|
||||
$message[] = '<li>Total files created: <b>'.$model->compiler->fileCount.'</b></li>';
|
||||
$message[] = '<li>Total fields created: <b>'.$model->compiler->fieldCount.'</b></li>';
|
||||
$message[] = '<li>Total lines written: <b>'.$model->compiler->lineCount.'</b></li>';
|
||||
$message[] = '<li>A4 Book of: <b>'.$model->compiler->pageCount.' pages</b></li>';
|
||||
$message[] = '<li>Total folders created: <b>#'.'##FOLDER_COUNT##'.'#</b></li>';
|
||||
$message[] = '<li>Total files created: <b>#'.'##FILE_COUNT##'.'#</b></li>';
|
||||
$message[] = '<li>Total fields created: <b>#'.'##FIELD_COUNT##'.'#</b></li>';
|
||||
$message[] = '<li>Total lines written: <b>#'.'##LINE_COUNT##'.'#</b></li>';
|
||||
$message[] = '<li>A4 Book of: <b>#'.'##PAGE_COUNT##'.'# pages</b></li>';
|
||||
$message[] = '</ul>';
|
||||
$message[] = '<p><b>'.$model->compiler->totalHours.' Hours</b> or <b>'.$model->compiler->totalDays.' Eight Hour Days</b> <em>(actual time you saved)</em><br />';
|
||||
$message[] = '<p><b>#'.'##totalHours##'.'# Hours</b> or <b>#'.'##totalDays##'.'# Eight Hour Days</b> <em>(actual time you saved)</em><br />';
|
||||
$message[] = '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, never making one mistake or taking any coffee break.)</small><br />';
|
||||
$message[] = '<b>'.$model->compiler->actualHoursSpent.' Hours</b> or <b>'.$model->compiler->actualDaysSpent.' Eight Hour Days</b> <em>(the actual time you spent)</em><br />';
|
||||
$message[] = '<small>(with the following break down: <b>debugging @'.$model->compiler->debuggingHours.'hours</b> = codingtime / 4; <b>planning @'.$model->compiler->planningHours.'hours</b> = codingtime / 7; <b>mapping @'.$model->compiler->mappingHours.'hours</b> = codingtime / 10; <b>office @'.$model->compiler->officeHours.'hours</b> = codingtime / 6;)</small></p>';
|
||||
$message[] = '<p><b>'.$model->compiler->actualTotalHours.' Hours</b> or <b>'.$model->compiler->actualTotalDays.' Eight Hour Days</b> <em>(a total of the realistic time frame for this project)</em><br />';
|
||||
$message[] = '<b>#'.'##actualHoursSpent##'.'# Hours</b> or <b>#'.'##actualDaysSpent##'.'# Eight Hour Days</b> <em>(the actual time you spent)</em><br />';
|
||||
$message[] = '<small>(with the following break down: <b>debugging @#'.'##debuggingHours##'.'#hours</b> = codingtime / 4; <b>planning @#'.'##planningHours##'.'#hours</b> = codingtime / 7; <b>mapping @#'.'##mappingHours##'.'#hours</b> = codingtime / 10; <b>office @#'.'##officeHours##'.'#hours</b> = codingtime / 6;)</small></p>';
|
||||
$message[] = '<p><b>#'.'##actualTotalHours##'.'# Hours</b> or <b>#'.'##actualTotalDays##'.'# Eight Hour Days</b> <em>(a total of the realistic time frame for this project)</em><br />';
|
||||
$message[] = '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)</small></p>';
|
||||
$message[] = '<p>Project duration: <b>'.$model->compiler->projectWeekTime. ' weeks</b> or <b>'.$model->compiler->projectMonthTime.' months</b></p>';
|
||||
$message[] = '<p>Project duration: <b>'.$model->compiler->projectWeekTime. ' weeks</b> or <b>#'.'##projectMonthTime##'.'# months</b></p>';
|
||||
// check if we have modules or plugins
|
||||
if ($add_multi_install)
|
||||
{
|
||||
@ -254,9 +254,14 @@ class ComponentbuilderControllerCompiler extends AdminController
|
||||
$message[] = '<a class="btn btn-success" href="' . $url . '" ><span class="icon-download icon-white"></span>Download</a></p>';
|
||||
$message[] = '<p><small><b>Remember!</b> This zip file is in your tmp folder and therefore publicly accessible until you click [Clear tmp]!</small> </p>';
|
||||
}
|
||||
$message[] = '<p><small>Compilation took <b>'.$model->compiler->secondsCompiled.'</b> seconds to complete.</small> </p>';
|
||||
$message[] = '<p><small>Compilation took <b>#'.'##COMPILER_TIMER##'.'#</b> seconds to complete.</small> </p>';
|
||||
// pass the message via the user state... wow this is painful
|
||||
$app->setUserState('com_componentbuilder.success_message', implode(PHP_EOL, $message));
|
||||
$app->setUserState('com_componentbuilder.success_message',
|
||||
CFactory::_('Placeholder')->update(
|
||||
implode(PHP_EOL, $message),
|
||||
CFactory::_('Content')->active
|
||||
)
|
||||
);
|
||||
// set redirect
|
||||
$this->setRedirect($redirect_url, '<h2>Successful Build!</h2>', 'message');
|
||||
$app->setUserState('com_componentbuilder.component_folder_name', $model->compiler->filepath['component-folder']);
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
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
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
@ -12,13 +12,22 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// add the autoloader for the composer classes
|
||||
$composer_autoloader = JPATH_LIBRARIES . '/phpseclib3/vendor/autoload.php';
|
||||
if (file_exists($composer_autoloader))
|
||||
{
|
||||
require_once $composer_autoloader;
|
||||
}
|
||||
|
||||
// register this component namespace
|
||||
spl_autoload_register(function ($class) {
|
||||
// project-specific base directories and namespace prefix
|
||||
$search = array(
|
||||
$search = [
|
||||
'libraries/jcb_powers/VDM.Joomla.Gitea' => 'VDM\\Joomla\\Gitea',
|
||||
'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla',
|
||||
'libraries/jcb_powers/VDM.Gitea' => 'VDM\\Gitea'
|
||||
);
|
||||
'libraries/jcb_powers/VDM.Minify' => 'VDM\\Minify',
|
||||
'libraries/jcb_powers/VDM.Psr' => 'VDM\\Psr'
|
||||
];
|
||||
// Start the search and load if found
|
||||
$found = false;
|
||||
$found_base_dir = "";
|
||||
@ -40,7 +49,7 @@ spl_autoload_register(function ($class) {
|
||||
// check if we found a match
|
||||
if (!$found)
|
||||
{
|
||||
// no, move to the next registered autoloader
|
||||
// not found so move to the next registered autoloader
|
||||
return;
|
||||
}
|
||||
// get the relative class name
|
||||
@ -64,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.
|
||||
@ -1071,8 +1080,6 @@ abstract class ComponentbuilderHelper
|
||||
{
|
||||
// import the Joomla librarys
|
||||
jimport('joomla.application.component.modellist');
|
||||
// include class to minify js
|
||||
require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/js.php';
|
||||
}
|
||||
// load only if smart
|
||||
if ('smart' === $type)
|
||||
@ -3813,31 +3820,31 @@ abstract class ComponentbuilderHelper
|
||||
switch ($mode)
|
||||
{
|
||||
case 'CTR':
|
||||
self::$CRYPT[$key] = new $CLASS($CLASS::MODE_CTR);
|
||||
self::$CRYPT[$key] = new $CLASS('ctr');
|
||||
break;
|
||||
case 'ECB':
|
||||
self::$CRYPT[$key] = new $CLASS($CLASS::MODE_ECB);
|
||||
self::$CRYPT[$key] = new $CLASS('ecb');
|
||||
break;
|
||||
case 'CBC':
|
||||
self::$CRYPT[$key] = new $CLASS($CLASS::MODE_CBC);
|
||||
self::$CRYPT[$key] = new $CLASS('cbc');
|
||||
break;
|
||||
case 'CBC3':
|
||||
self::$CRYPT[$key] = new $CLASS($CLASS::MODE_CBC3);
|
||||
self::$CRYPT[$key] = new $CLASS('cbc3');
|
||||
break;
|
||||
case 'CFB':
|
||||
self::$CRYPT[$key] = new $CLASS($CLASS::MODE_CFB);
|
||||
self::$CRYPT[$key] = new $CLASS('cfb');
|
||||
break;
|
||||
case 'CFB8':
|
||||
self::$CRYPT[$key] = new $CLASS($CLASS::MODE_CFB8);
|
||||
self::$CRYPT[$key] = new $CLASS('cfb8');
|
||||
break;
|
||||
case 'OFB':
|
||||
self::$CRYPT[$key] = new $CLASS($CLASS::MODE_OFB);
|
||||
self::$CRYPT[$key] = new $CLASS('ofb');
|
||||
break;
|
||||
case 'GCM':
|
||||
self::$CRYPT[$key] = new $CLASS($CLASS::MODE_GCM);
|
||||
self::$CRYPT[$key] = new $CLASS('gcm');
|
||||
break;
|
||||
case 'STREAM':
|
||||
self::$CRYPT[$key] = new $CLASS($CLASS::MODE_STREAM);
|
||||
self::$CRYPT[$key] = new $CLASS('stream');
|
||||
break;
|
||||
default:
|
||||
// No valid mode has been specified
|
||||
@ -3848,7 +3855,7 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
else
|
||||
{
|
||||
// set the
|
||||
// set the default
|
||||
self::$CRYPT[$key] = new $CLASS();
|
||||
}
|
||||
// return the object
|
||||
@ -5516,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
|
||||
*
|
||||
@ -6321,11 +5763,6 @@ abstract class ComponentbuilderHelper
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_COMPILER'), 'index.php?option=com_componentbuilder&view=compiler', $submenu === 'compiler');
|
||||
}
|
||||
// Access control (search.submenu).
|
||||
if ($user->authorise('search.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_SEARCH'), 'index.php?option=com_componentbuilder&view=search', $submenu === 'search');
|
||||
}
|
||||
if ($user->authorise('joomla_component.access', 'com_componentbuilder') && $user->authorise('joomla_component.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_COMPONENTS'), 'index.php?option=com_componentbuilder&view=joomla_components', $submenu === 'joomla_components');
|
||||
@ -6342,6 +5779,11 @@ abstract class ComponentbuilderHelper
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_POWERS'), 'index.php?option=com_componentbuilder&view=powers', $submenu === 'powers');
|
||||
}
|
||||
// Access control (search.access && search.submenu).
|
||||
if ($user->authorise('search.access', 'com_componentbuilder') && $user->authorise('search.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_SEARCH'), 'index.php?option=com_componentbuilder&view=search', $submenu === 'search');
|
||||
}
|
||||
if ($user->authorise('admin_view.access', 'com_componentbuilder') && $user->authorise('admin_view.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_ADMIN_VIEWS'), 'index.php?option=com_componentbuilder&view=admin_views', $submenu === 'admin_views');
|
||||
|
@ -26,6 +26,11 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Mapping class
|
||||
*/
|
||||
@ -102,7 +107,7 @@ class Mapping
|
||||
// set the app to insure messages can be set
|
||||
$this->app = JFactory::getApplication();
|
||||
// check that we have data
|
||||
if (ComponentbuilderHelper::checkArray($data))
|
||||
if (ArrayHelper::check($data))
|
||||
{
|
||||
// make sure we have an id
|
||||
if (isset($data['id']) && $data['id'] > 0)
|
||||
@ -117,15 +122,15 @@ class Mapping
|
||||
{
|
||||
case 'base64':
|
||||
// set needed value
|
||||
$this->$key = base64_decode($value);
|
||||
$this->$key = base64_decode((string) $value);
|
||||
break;
|
||||
case 'json':
|
||||
// set needed value
|
||||
$this->$key = json_decode($value, true);
|
||||
$this->$key = json_decode((string) $value, true);
|
||||
break;
|
||||
case 'safeString':
|
||||
// set needed value
|
||||
$this->$key = ComponentbuilderHelper::safeString($value);
|
||||
$this->$key = StringHelper::check($value);
|
||||
break;
|
||||
default :
|
||||
$this->$key = $value;
|
||||
@ -134,10 +139,10 @@ class Mapping
|
||||
}
|
||||
}
|
||||
// get linked admin views
|
||||
$addadmin_views = ComponentbuilderHelper::getVar('component_admin_views', $data['id'], 'joomla_component', 'addadmin_views');
|
||||
if (ComponentbuilderHelper::checkJson($addadmin_views))
|
||||
$addadmin_views = GetHelper::var('component_admin_views', $data['id'], 'joomla_component', 'addadmin_views');
|
||||
if (JsonHelper::check($addadmin_views))
|
||||
{
|
||||
$this->addadmin_views = json_decode($addadmin_views, true);
|
||||
$this->addadmin_views = json_decode((string)$addadmin_views, true);
|
||||
}
|
||||
// set the map of the views needed
|
||||
if ($this->setMap())
|
||||
@ -173,7 +178,7 @@ class Mapping
|
||||
{
|
||||
// start parsing the sql dump data
|
||||
$queries = JDatabaseDriver::splitSql($this->buildcompsql);
|
||||
if (ComponentbuilderHelper::checkArray($queries))
|
||||
if (ArrayHelper::check($queries))
|
||||
{
|
||||
foreach ($queries as $query)
|
||||
{
|
||||
@ -208,7 +213,7 @@ class Mapping
|
||||
}
|
||||
}
|
||||
// check if the mapping was done
|
||||
if (ComponentbuilderHelper::checkArray($this->map))
|
||||
if (ArrayHelper::check($this->map))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -224,12 +229,12 @@ class Mapping
|
||||
if (strpos($query, '`#__') !== false)
|
||||
{
|
||||
// get table name
|
||||
$tableName = ComponentbuilderHelper::getBetween($query, '`#__', "`");
|
||||
$tableName = GetHelper::between($query, '`#__', "`");
|
||||
}
|
||||
elseif (strpos($query, "'#__") !== false)
|
||||
{
|
||||
// get table name
|
||||
$tableName = ComponentbuilderHelper::getBetween($query, "'#__", "'");
|
||||
$tableName = GetHelper::between($query, "'#__", "'");
|
||||
}
|
||||
// if it still was not found
|
||||
if (!isset($tableName) || !ComponentbuilderHelper::checkString($tableName))
|
||||
@ -267,12 +272,12 @@ class Mapping
|
||||
if (0 === strpos($row, '`'))
|
||||
{
|
||||
// get field name
|
||||
$name = ComponentbuilderHelper::getBetween($row, '`', '`');
|
||||
$name = GetHelper::between($row, '`', '`');
|
||||
}
|
||||
if (0 === strpos($row, "'"))
|
||||
{
|
||||
// get field name
|
||||
$name = ComponentbuilderHelper::getBetween($row, "'", "'");
|
||||
$name = GetHelper::between($row, "'", "'");
|
||||
}
|
||||
// check if the name was found
|
||||
if (ComponentbuilderHelper::checkString($name))
|
||||
@ -289,7 +294,7 @@ class Mapping
|
||||
{
|
||||
$field['row'] = $row;
|
||||
$field['name'] = $name;
|
||||
$field['label'] = ComponentbuilderHelper::safeString($name, 'W');
|
||||
$field['label'] = StringHelper::check($name, 'W');
|
||||
$field['fieldType'] = $fieldType;
|
||||
$field['size'] = $this->getSize($row, $field);
|
||||
$field['sizeOther'] = '';
|
||||
@ -319,7 +324,7 @@ class Mapping
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ComponentbuilderHelper::checkArray($fields))
|
||||
if (ArrayHelper::check($fields))
|
||||
{
|
||||
return $fields;
|
||||
}
|
||||
@ -352,7 +357,7 @@ class Mapping
|
||||
{
|
||||
if (in_array($field['dataType'], $this->dataSize))
|
||||
{
|
||||
return ComponentbuilderHelper::getBetween($row, $field['dataType'].'(', ')');
|
||||
return GetHelper::between($row, $field['dataType'].'(', ')');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
@ -365,12 +370,12 @@ class Mapping
|
||||
// get default value
|
||||
if (strpos($row, 'DEFAULT "') !== false) // to sure it this is correct...
|
||||
{
|
||||
return ComponentbuilderHelper::getBetween($row, 'DEFAULT "', '"');
|
||||
return GetHelper::between($row, 'DEFAULT "', '"');
|
||||
}
|
||||
// get default value
|
||||
if (strpos($row, "DEFAULT '") !== false)
|
||||
{
|
||||
return ComponentbuilderHelper::getBetween($row, "DEFAULT '", "'");
|
||||
return GetHelper::between($row, "DEFAULT '", "'");
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
@ -26,6 +26,10 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
|
||||
/**
|
||||
* Builder class
|
||||
*/
|
||||
@ -102,7 +106,7 @@ class Builder extends Mapping
|
||||
{
|
||||
// set the view object
|
||||
$object = new stdClass();
|
||||
$object->system_name = ComponentbuilderHelper::safeString($name, 'W') . ' (dynamic build)';
|
||||
$object->system_name = StringHelper::check($name, 'W') . ' (dynamic build)';
|
||||
$object->name_single = $name;
|
||||
$object->name_list = $name. 's';
|
||||
$object->short_description = $name. ' view (dynamic build)';
|
||||
@ -257,14 +261,14 @@ class Builder extends Mapping
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the field type id from system
|
||||
*/
|
||||
protected function getFieldType($fieldName)
|
||||
{
|
||||
// load the field settings
|
||||
return ComponentbuilderHelper::getVar('fieldtype', $fieldName, 'name', 'id');
|
||||
return GetHelper::var('fieldtype', $fieldName, 'name', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,6 +26,9 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Extrusion class
|
||||
*/
|
||||
@ -58,10 +61,10 @@ class Extrusion extends Builder
|
||||
protected function setAdminViews(&$component_id)
|
||||
{
|
||||
// check if views were set
|
||||
if (ComponentbuilderHelper::checkArray($this->views))
|
||||
if (ArrayHelper::check($this->views))
|
||||
{
|
||||
$count = 0;
|
||||
if (ComponentbuilderHelper::checkArray($this->addadmin_views))
|
||||
if (ArrayHelper::check($this->addadmin_views))
|
||||
{
|
||||
$count = (int) count((array)$this->addadmin_views) + 3;
|
||||
}
|
||||
@ -84,7 +87,7 @@ class Extrusion extends Builder
|
||||
$this->addadmin_views['addadmin_views'.$pointer]['order'] = $pointer + 1;
|
||||
}
|
||||
}
|
||||
if (isset($this->addadmin_views) && ComponentbuilderHelper::checkArray($this->addadmin_views))
|
||||
if (isset($this->addadmin_views) && ArrayHelper::check($this->addadmin_views))
|
||||
{
|
||||
// set the field object
|
||||
$object = new stdClass();
|
||||
@ -94,7 +97,7 @@ class Extrusion extends Builder
|
||||
$object->created_by = $this->user->id;
|
||||
$object->published = 1;
|
||||
// check if it is already set
|
||||
if ($item_id = ComponentbuilderHelper::getVar('component_admin_views', $component_id, 'joomla_component', 'id'))
|
||||
if ($item_id = GetHelper::var('component_admin_views', $component_id, 'joomla_component', 'id'))
|
||||
{
|
||||
// set ID
|
||||
$object->id = (int) $item_id;
|
||||
|
@ -1,7 +0,0 @@
|
||||
in
|
||||
public
|
||||
extends
|
||||
private
|
||||
protected
|
||||
implements
|
||||
instanceof
|
@ -1,28 +0,0 @@
|
||||
do
|
||||
in
|
||||
let
|
||||
new
|
||||
var
|
||||
case
|
||||
else
|
||||
enum
|
||||
void
|
||||
with
|
||||
class
|
||||
const
|
||||
yield
|
||||
delete
|
||||
export
|
||||
import
|
||||
public
|
||||
return
|
||||
static
|
||||
typeof
|
||||
extends
|
||||
package
|
||||
private
|
||||
continue
|
||||
function
|
||||
protected
|
||||
implements
|
||||
instanceof
|
@ -1,47 +0,0 @@
|
||||
do
|
||||
if
|
||||
in
|
||||
for
|
||||
let
|
||||
new
|
||||
try
|
||||
var
|
||||
case
|
||||
else
|
||||
enum
|
||||
eval
|
||||
null
|
||||
this
|
||||
true
|
||||
void
|
||||
with
|
||||
break
|
||||
catch
|
||||
class
|
||||
const
|
||||
false
|
||||
super
|
||||
throw
|
||||
while
|
||||
yield
|
||||
delete
|
||||
export
|
||||
import
|
||||
public
|
||||
return
|
||||
static
|
||||
switch
|
||||
typeof
|
||||
default
|
||||
extends
|
||||
finally
|
||||
package
|
||||
private
|
||||
continue
|
||||
debugger
|
||||
function
|
||||
arguments
|
||||
interface
|
||||
protected
|
||||
implements
|
||||
instanceof
|
@ -1,381 +0,0 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage minify.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Abstract minifier class.
|
||||
*
|
||||
* Please report bugs on https://github.com/matthiasmullie/minify/issues
|
||||
*
|
||||
* @author Matthias Mullie <minify@mullie.eu>
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved.
|
||||
* @license MIT License
|
||||
*/
|
||||
abstract class Minify
|
||||
{
|
||||
/**
|
||||
* The data to be minified
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $data = array();
|
||||
|
||||
/**
|
||||
* Array of patterns to match.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $patterns = array();
|
||||
|
||||
/**
|
||||
* This array will hold content of strings and regular expressions that have
|
||||
* been extracted from the JS source code, so we can reliably match "code",
|
||||
* without having to worry about potential "code-like" characters inside.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $extracted = array();
|
||||
|
||||
/**
|
||||
* Init the minify class - optionally, code may be passed along already.
|
||||
*/
|
||||
public function __construct(/* $data = null, ... */)
|
||||
{
|
||||
// it's possible to add the source through the constructor as well ;)
|
||||
if (func_num_args()) {
|
||||
call_user_func_array(array($this, 'add'), func_get_args());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a file or straight-up code to be minified.
|
||||
*
|
||||
* @param string $data
|
||||
*/
|
||||
public function add($data /* $data = null, ... */)
|
||||
{
|
||||
// bogus "usage" of parameter $data: scrutinizer warns this variable is
|
||||
// not used (we're using func_get_args instead to support overloading),
|
||||
// but it still needs to be defined because it makes no sense to have
|
||||
// this function without argument :)
|
||||
$args = array($data) + func_get_args();
|
||||
|
||||
// this method can be overloaded
|
||||
foreach ($args as $data) {
|
||||
// redefine var
|
||||
$data = (string) $data;
|
||||
|
||||
// load data
|
||||
$value = $this->load($data);
|
||||
$key = ($data != $value) ? $data : count($this->data);
|
||||
|
||||
// store data
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data.
|
||||
*
|
||||
* @param string $data Either a path to a file or the content itself.
|
||||
* @return string
|
||||
*/
|
||||
protected function load($data)
|
||||
{
|
||||
// check if the data is a file
|
||||
if (@file_exists($data) && is_file($data)) {
|
||||
$data = @file_get_contents($data);
|
||||
|
||||
// strip BOM, if any
|
||||
if (substr($data, 0, 3) == "\xef\xbb\xbf") {
|
||||
$data = substr($data, 3);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save to file
|
||||
*
|
||||
* @param string $content The minified data.
|
||||
* @param string $path The path to save the minified data to.
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function save($content, $path)
|
||||
{
|
||||
// create file & open for writing
|
||||
if (($handler = @fopen($path, 'w')) === false) {
|
||||
throw new Exception('The file "'.$path.'" could not be opened. Check if PHP has enough permissions.');
|
||||
}
|
||||
|
||||
// write to file
|
||||
if (@fwrite($handler, $content) === false) {
|
||||
throw new Exception('The file "'.$path.'" could not be written to. Check if PHP has enough permissions.');
|
||||
}
|
||||
|
||||
// close the file
|
||||
@fclose($handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Minify the data & (optionally) saves it to a file.
|
||||
*
|
||||
* @param string[optional] $path Path to write the data to.
|
||||
* @return string The minified data.
|
||||
*/
|
||||
public function minify($path = null)
|
||||
{
|
||||
$content = $this->execute($path);
|
||||
|
||||
// save to path
|
||||
if ($path !== null) {
|
||||
$this->save($content, $path);
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minify & gzip the data & (optionally) saves it to a file.
|
||||
*
|
||||
* @param string[optional] $path Path to write the data to.
|
||||
* @param int[optional] $level Compression level, from 0 to 9.
|
||||
* @return string The minified & gzipped data.
|
||||
*/
|
||||
public function gzip($path = null, $level = 9)
|
||||
{
|
||||
$content = $this->execute($path);
|
||||
$content = gzencode($content, $level, FORCE_GZIP);
|
||||
|
||||
// save to path
|
||||
if ($path !== null) {
|
||||
$this->save($content, $path);
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minify the data.
|
||||
*
|
||||
* @param string[optional] $path Path to write the data to.
|
||||
* @return string The minified data.
|
||||
*/
|
||||
abstract protected function execute($path = null);
|
||||
|
||||
/**
|
||||
* Register a pattern to execute against the source content.
|
||||
*
|
||||
* @param string $pattern PCRE pattern.
|
||||
* @param string|callable $replacement Replacement value for matched pattern.
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function registerPattern($pattern, $replacement = '')
|
||||
{
|
||||
// study the pattern, we'll execute it more than once
|
||||
$pattern .= 'S';
|
||||
|
||||
$this->patterns[] = array($pattern, $replacement);
|
||||
}
|
||||
|
||||
/**
|
||||
* We can't "just" run some regular expressions against JavaScript: it's a
|
||||
* complex language. E.g. having an occurrence of // xyz would be a comment,
|
||||
* unless it's used within a string. Of you could have something that looks
|
||||
* like a 'string', but inside a comment.
|
||||
* The only way to accurately replace these pieces is to traverse the JS one
|
||||
* character at a time and try to find whatever starts first.
|
||||
*
|
||||
* @param string $content The content to replace patterns in.
|
||||
* @return string The (manipulated) content.
|
||||
*/
|
||||
protected function replace($content)
|
||||
{
|
||||
$processed = '';
|
||||
$positions = array_fill(0, count($this->patterns), -1);
|
||||
$matches = array();
|
||||
|
||||
while ($content) {
|
||||
// find first match for all patterns
|
||||
foreach ($this->patterns as $i => $pattern) {
|
||||
list($pattern, $replacement) = $pattern;
|
||||
|
||||
// no need to re-run matches that are still in the part of the
|
||||
// content that hasn't been processed
|
||||
if ($positions[$i] >= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$match = null;
|
||||
if (preg_match($pattern, $content, $match)) {
|
||||
$matches[$i] = $match;
|
||||
|
||||
// we'll store the match position as well; that way, we
|
||||
// don't have to redo all preg_matches after changing only
|
||||
// the first (we'll still know where those others are)
|
||||
$positions[$i] = strpos($content, $match[0]);
|
||||
} else {
|
||||
// if the pattern couldn't be matched, there's no point in
|
||||
// executing it again in later runs on this same content;
|
||||
// ignore this one until we reach end of content
|
||||
unset($matches[$i]);
|
||||
$positions[$i] = strlen($content);
|
||||
}
|
||||
}
|
||||
|
||||
// no more matches to find: everything's been processed, break out
|
||||
if (!$matches) {
|
||||
$processed .= $content;
|
||||
break;
|
||||
}
|
||||
|
||||
// see which of the patterns actually found the first thing (we'll
|
||||
// only want to execute that one, since we're unsure if what the
|
||||
// other found was not inside what the first found)
|
||||
$discardLength = min($positions);
|
||||
$firstPattern = array_search($discardLength, $positions);
|
||||
$match = $matches[$firstPattern][0];
|
||||
|
||||
// execute the pattern that matches earliest in the content string
|
||||
list($pattern, $replacement) = $this->patterns[$firstPattern];
|
||||
$replacement = $this->replacePattern($pattern, $replacement, $content);
|
||||
|
||||
// figure out which part of the string was unmatched; that's the
|
||||
// part we'll execute the patterns on again next
|
||||
$content = substr($content, $discardLength);
|
||||
$unmatched = (string) substr($content, strpos($content, $match) + strlen($match));
|
||||
|
||||
// move the replaced part to $processed and prepare $content to
|
||||
// again match batch of patterns against
|
||||
$processed .= substr($replacement, 0, strlen($replacement) - strlen($unmatched));
|
||||
$content = $unmatched;
|
||||
|
||||
// first match has been replaced & that content is to be left alone,
|
||||
// the next matches will start after this replacement, so we should
|
||||
// fix their offsets
|
||||
foreach ($positions as $i => $position) {
|
||||
$positions[$i] -= $discardLength + strlen($match);
|
||||
}
|
||||
}
|
||||
|
||||
return $processed;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is where a pattern is matched against $content and the matches
|
||||
* are replaced by their respective value.
|
||||
* This function will be called plenty of times, where $content will always
|
||||
* move up 1 character.
|
||||
*
|
||||
* @param string $pattern Pattern to match.
|
||||
* @param string|callable $replacement Replacement value.
|
||||
* @param string $content Content to match pattern against.
|
||||
* @return string
|
||||
*/
|
||||
protected function replacePattern($pattern, $replacement, $content)
|
||||
{
|
||||
if (is_callable($replacement)) {
|
||||
return preg_replace_callback($pattern, $replacement, $content, 1, $count);
|
||||
} else {
|
||||
return preg_replace($pattern, $replacement, $content, 1, $count);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Strings are a pattern we need to match, in order to ignore potential
|
||||
* code-like content inside them, but we just want all of the string
|
||||
* content to remain untouched.
|
||||
*
|
||||
* This method will replace all string content with simple STRING#
|
||||
* placeholder text, so we've rid all strings from characters that may be
|
||||
* misinterpreted. Original string content will be saved in $this->extracted
|
||||
* and after doing all other minifying, we can restore the original content
|
||||
* via restoreStrings()
|
||||
*
|
||||
* @param string[optional] $chars
|
||||
*/
|
||||
protected function extractStrings($chars = '\'"')
|
||||
{
|
||||
// PHP only supports $this inside anonymous functions since 5.4
|
||||
$minifier = $this;
|
||||
$callback = function ($match) use ($minifier) {
|
||||
if (!$match[1]) {
|
||||
/*
|
||||
* Empty strings need no placeholder; they can't be confused for
|
||||
* anything else anyway.
|
||||
* But we still needed to match them, for the extraction routine
|
||||
* to skip over this particular string.
|
||||
*/
|
||||
return $match[0];
|
||||
}
|
||||
|
||||
$count = count($minifier->extracted);
|
||||
$placeholder = $match[1].$count.$match[1];
|
||||
$minifier->extracted[$placeholder] = $match[1].$match[2].$match[1];
|
||||
|
||||
return $placeholder;
|
||||
};
|
||||
|
||||
/*
|
||||
* The \\ messiness explained:
|
||||
* * Don't count ' or " as end-of-string if it's escaped (has backslash
|
||||
* in front of it)
|
||||
* * Unless... that backslash itself is escaped (another leading slash),
|
||||
* in which case it's no longer escaping the ' or "
|
||||
* * So there can be either no backslash, or an even number
|
||||
* * multiply all of that times 4, to account for the escaping that has
|
||||
* to be done to pass the backslash into the PHP string without it being
|
||||
* considered as escape-char (times 2) and to get it in the regex,
|
||||
* escaped (times 2)
|
||||
*/
|
||||
$this->registerPattern('/(['.$chars.'])(.*?((?<!\\\\)|\\\\\\\\+))\\1/s', $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will restore all extracted data (strings, regexes) that were
|
||||
* replaced with placeholder text in extract*(). The original content was
|
||||
* saved in $this->extracted.
|
||||
*
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
protected function restoreExtractedData($content)
|
||||
{
|
||||
if (!$this->extracted) {
|
||||
// nothing was extracted, nothing to restore
|
||||
return $content;
|
||||
}
|
||||
|
||||
$content = strtr($content, $this->extracted);
|
||||
|
||||
$this->extracted = array();
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
+
|
||||
-
|
||||
*
|
||||
/
|
||||
%
|
||||
=
|
||||
+=
|
||||
-=
|
||||
*=
|
||||
/=
|
||||
%=
|
||||
<<=
|
||||
>>=
|
||||
>>>=
|
||||
&=
|
||||
^=
|
||||
|=
|
||||
&
|
||||
|
|
||||
^
|
||||
~
|
||||
<<
|
||||
>>
|
||||
>>>
|
||||
==
|
||||
===
|
||||
!=
|
||||
!==
|
||||
>
|
||||
<
|
||||
>=
|
||||
<=
|
||||
&&
|
||||
||
|
||||
.
|
||||
[
|
||||
]
|
||||
?
|
||||
:
|
||||
,
|
||||
;
|
||||
(
|
||||
)
|
||||
{
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
+
|
||||
-
|
||||
*
|
||||
/
|
||||
%
|
||||
=
|
||||
+=
|
||||
-=
|
||||
*=
|
||||
/=
|
||||
%=
|
||||
<<=
|
||||
>>=
|
||||
>>>=
|
||||
&=
|
||||
^=
|
||||
|=
|
||||
&
|
||||
|
|
||||
^
|
||||
~
|
||||
<<
|
||||
>>
|
||||
>>>
|
||||
==
|
||||
===
|
||||
!=
|
||||
!==
|
||||
>
|
||||
<
|
||||
>=
|
||||
<=
|
||||
&&
|
||||
||
|
||||
!
|
||||
.
|
||||
[
|
||||
?
|
||||
:
|
||||
,
|
||||
;
|
||||
(
|
||||
{
|
File diff suppressed because one or more lines are too long
@ -85,8 +85,6 @@ COM_COMPONENTBUILDER_ADMIN_VIEWS_BATCH_USE="Admin Views Batch Use"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEWS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch admin views"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEWS_CREATE="Admin Views Create"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEWS_CREATE_DESC="Allows the users in this group to create create admin views"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEWS_DASHBOARD_ADD="Admin Views Dashboard Add"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEWS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of admin view"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEWS_DASHBOARD_LIST="Admin Views Dashboard List"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEWS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of admin view"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEWS_DELETE="Admin Views Delete"
|
||||
@ -440,8 +438,6 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_BATCH_USE="Custom Admin Views Batch Use"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch custom admin views"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_CREATE="Custom Admin Views Create"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_CREATE_DESC="Allows the users in this group to create create custom admin views"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_ADD="Custom Admin Views Dashboard Add"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of custom admin view"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_LIST="Custom Admin Views Dashboard List"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of custom admin view"
|
||||
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DELETE="Custom Admin Views Delete"
|
||||
@ -1016,12 +1012,20 @@ 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"
|
||||
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS_DESC="Allows the users in this group to access the compiler button."
|
||||
COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST="Search Dashboard List"
|
||||
COM_COMPONENTBUILDER_SEARCH_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of Search"
|
||||
COM_COMPONENTBUILDER_SEARCH_SUBMENU="Search Submenu"
|
||||
COM_COMPONENTBUILDER_SEARCH_SUBMENU_DESC="Allows the users in this group to submenu of Search"
|
||||
COM_COMPONENTBUILDER_SERVERS_ACCESS="Servers Access"
|
||||
@ -1058,8 +1062,6 @@ COM_COMPONENTBUILDER_SITE_VIEWS_BATCH_USE="Site Views Batch Use"
|
||||
COM_COMPONENTBUILDER_SITE_VIEWS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch site views"
|
||||
COM_COMPONENTBUILDER_SITE_VIEWS_CREATE="Site Views Create"
|
||||
COM_COMPONENTBUILDER_SITE_VIEWS_CREATE_DESC="Allows the users in this group to create create site views"
|
||||
COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_ADD="Site Views Dashboard Add"
|
||||
COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of site view"
|
||||
COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_LIST="Site Views Dashboard List"
|
||||
COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of site view"
|
||||
COM_COMPONENTBUILDER_SITE_VIEWS_DELETE="Site Views Delete"
|
||||
|
116
admin/layouts/jcbsupportmessage.php
Normal file
116
admin/layouts/jcbsupportmessage.php
Normal 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 />
|
45
admin/layouts/power/composer_fullwidth.php
Normal file
45
admin/layouts/power/composer_fullwidth.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?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(
|
||||
'autoload_composer_note',
|
||||
'composer'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="form-vertical">
|
||||
<?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; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
43
admin/layouts/power/super_power_left.php
Normal file
43
admin/layouts/power/super_power_left.php
Normal 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; ?>
|
42
admin/layouts/power/super_power_right.php
Normal file
42
admin/layouts/power/super_power_right.php
Normal 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; ?>
|
43
admin/layouts/rows.php
Normal file
43
admin/layouts/rows.php
Normal 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('JPATH_BASE') or die('Restricted access');
|
||||
|
||||
$headers = $displayData['headers'];
|
||||
$items = $displayData['items'];
|
||||
|
||||
?>
|
||||
<?php if (is_array($items)): ?>
|
||||
<?php foreach ($items as $row => $values): ?>
|
||||
<tr>
|
||||
<?php foreach($values as $value): ?>
|
||||
<td class=""><?php echo $value; ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php elseif (is_numeric($items) && is_array($headers)): ?>
|
||||
<?php for( $row = 0; $row < $items; $row++): ?>
|
||||
<tr class="">
|
||||
<?php foreach($headers as $header): ?>
|
||||
<td class=""> </td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endfor; ?>
|
||||
<?php elseif (is_numeric($items) && is_numeric($headers)): ?>
|
||||
<?php for( $row = 0; $row < $items; $row++): ?>
|
||||
<tr class="">
|
||||
<?php for( $column = 0; $column < $headers; $column++): ?>
|
||||
<td class=""> </td>
|
||||
<?php endfor; ?>
|
||||
</tr>
|
||||
<?php endfor; ?>
|
||||
<?php endif; ?>
|
72
admin/layouts/table.php
Normal file
72
admin/layouts/table.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?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');
|
||||
|
||||
$table_id = (isset($displayData['id'])) ? $displayData['id'] : ComponentbuilderHelper::randomkey(7);
|
||||
$name = (isset($displayData['name'])) ? $displayData['name'] : false;
|
||||
$headers = (isset($displayData['headers'])) ? $displayData['headers'] : [JText::_('COM_COMPONENTBUILDER_NO'), JText::_('COM_COMPONENTBUILDER_HEADERS'), JText::_('COM_COMPONENTBUILDER_FOUND')];
|
||||
$items = (isset($displayData['items'])) ? $displayData['items'] : 6;
|
||||
|
||||
?>
|
||||
<div class="uk-overflow-auto">
|
||||
<table id="<?php echo $table_id; ?>" class="uk-table">
|
||||
<thead>
|
||||
<?php if (is_array($headers)): ?>
|
||||
<?php if ($name): ?>
|
||||
<tr>
|
||||
<th colspan="<?php echo count($headers); ?>" style="text-align:center"><b><?php echo $name; ?></b></th>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr>
|
||||
<?php foreach($headers as $code_name => $header): ?>
|
||||
<?php
|
||||
if (is_numeric($code_name))
|
||||
{
|
||||
$code_name = ComponentbuilderHelper::safeString($header);
|
||||
}
|
||||
?>
|
||||
<th data-name="<?php echo $code_name; ?>"><?php echo $header; ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php elseif (is_numeric($headers)): ?>
|
||||
<?php if ($name): ?>
|
||||
<tr>
|
||||
<th colspan="<?php echo (int) $headers; ?>" style="text-align:center"><b><?php echo $name; ?></b></th>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr style="position: absolute; top: -9999px; left: -9999px;">
|
||||
<?php for( $row = 0; $row < $headers; $row++): ?>
|
||||
<th><?php echo ComponentbuilderHelper::safeString($row); ?></th>
|
||||
<?php endfor; ?>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php echo JLayoutHelper::render('rows', ['headers' => $headers, 'items' => $items]); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
// Initialize the table if [init is not set], or [is true]
|
||||
// To stop initialization set $displayData['init'] = false;
|
||||
if (!isset($displayData['init']) || $displayData['init']) :
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
var <?php echo $table_id; ?> = jQuery('#<?php echo $table_id; ?>').DataTable({
|
||||
paging: false,
|
||||
select: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php endif; ?>
|
@ -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) . ')');
|
||||
}
|
||||
|
@ -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
|
||||
@ -3610,6 +3591,7 @@ class ComponentbuilderModelAjax extends ListModel
|
||||
* Search for value in a table
|
||||
*
|
||||
* @param string $tableName The main table to search
|
||||
* @param int $typeSearch The type of search being done
|
||||
* @param string $searchValue The value to search for
|
||||
* @param int $matchCase The switch to control match case
|
||||
* @param int $wholeWord The switch to control whole word
|
||||
@ -3619,26 +3601,43 @@ class ComponentbuilderModelAjax extends ListModel
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function searchTable(string $tableName, string $searchValue,
|
||||
public function doSearch(string $tableName, int $typeSearch, string $searchValue,
|
||||
int $matchCase, int $wholeWord, int $regexSearch, int $componentId): ?array
|
||||
{
|
||||
// check if this is a valid table
|
||||
if (SearchFactory::_('Table')->exist($tableName))
|
||||
{
|
||||
// load the configurations
|
||||
SearchFactory::_('Config')->table_name = $tableName;
|
||||
SearchFactory::_('Config')->search_value = $searchValue;
|
||||
SearchFactory::_('Config')->match_case = $matchCase;
|
||||
SearchFactory::_('Config')->whole_word = $wholeWord;
|
||||
SearchFactory::_('Config')->regex_search = $regexSearch;
|
||||
SearchFactory::_('Config')->component_id = $componentId;
|
||||
|
||||
if (($items = SearchFactory::_('Agent')->find()) !== null)
|
||||
try
|
||||
{
|
||||
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S', $tableName), 'items' => $items];
|
||||
}
|
||||
// load the configurations
|
||||
SearchFactory::_('Config')->table_name = $tableName;
|
||||
SearchFactory::_('Config')->type_search = $typeSearch;
|
||||
SearchFactory::_('Config')->search_value = $searchValue;
|
||||
SearchFactory::_('Config')->match_case = $matchCase;
|
||||
SearchFactory::_('Config')->whole_word = $wholeWord;
|
||||
SearchFactory::_('Config')->regex_search = $regexSearch;
|
||||
SearchFactory::_('Config')->component_id = $componentId;
|
||||
|
||||
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_S', $tableName)];
|
||||
if (($items = SearchFactory::_('Agent')->table($tableName)) !== null)
|
||||
{
|
||||
return [
|
||||
'success' => JText::sprintf('COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S', $tableName),
|
||||
'items' => $items,
|
||||
'fields_count' => SearchFactory::_('Config')->field_counter,
|
||||
'line_count' => SearchFactory::_('Config')->line_counter
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'not_found' => JText::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_IN_S', $tableName),
|
||||
'fields_count' => SearchFactory::_('Config')->field_counter,
|
||||
'line_count' => SearchFactory::_('Config')->line_counter
|
||||
];
|
||||
}
|
||||
catch(Exception $error)
|
||||
{
|
||||
return ['error' => $error->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
|
||||
@ -3649,33 +3648,159 @@ class ComponentbuilderModelAjax extends ListModel
|
||||
*
|
||||
* @param string $tableName The main table to search
|
||||
* @param string $searchValue The value to search for
|
||||
* @param string|null $replaceValue The value to replace search value
|
||||
* @param int $matchCase The switch to control match case
|
||||
* @param int $wholeWord The switch to control whole word
|
||||
* @param int $regexSearch The switch to control regex search
|
||||
* @param int $componentId The option to filter by component
|
||||
* @param string|null $replaceValue The value to replace search value
|
||||
* @param int $matchCase The switch to control match case
|
||||
* @param int $wholeWord The switch to control whole word
|
||||
* @param int $regexSearch The switch to control regex search
|
||||
* @param int $componentId The option to filter by component
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function updateTable(string $tableName, string $searchValue, ?string $replaceValue = null,
|
||||
public function replaceAll(string $tableName, string $searchValue, ?string $replaceValue = null,
|
||||
int $matchCase, int $wholeWord, int $regexSearch, int $componentId): ?array
|
||||
{
|
||||
// check if this is a valid table
|
||||
if (SearchFactory('Table')->exist($tableName))
|
||||
if (SearchFactory::_('Table')->exist($tableName))
|
||||
{
|
||||
// load the configurations
|
||||
SearchFactory('Config')->table_name = $tableName;
|
||||
SearchFactory('Config')->search_value = $searchValue;
|
||||
SearchFactory('Config')->replace_value = $replaceValue;
|
||||
SearchFactory('Config')->match_case = $matchCase;
|
||||
SearchFactory('Config')->whole_word = $wholeWord;
|
||||
SearchFactory('Config')->regex_search = $regexSearch;
|
||||
SearchFactory('Config')->component_id = $componentId;
|
||||
try
|
||||
{
|
||||
// load the configurations
|
||||
SearchFactory::_('Config')->table_name = $tableName;
|
||||
SearchFactory::_('Config')->search_value = $searchValue;
|
||||
SearchFactory::_('Config')->replace_value = $replaceValue;
|
||||
SearchFactory::_('Config')->match_case = $matchCase;
|
||||
SearchFactory::_('Config')->whole_word = $wholeWord;
|
||||
SearchFactory::_('Config')->regex_search = $regexSearch;
|
||||
SearchFactory::_('Config')->component_id = $componentId;
|
||||
|
||||
SearchFactory('Agent')->replace();
|
||||
if (($number = SearchFactory::_('Agent')->replace()) !== 0)
|
||||
{
|
||||
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_ALL_FOUND_INSTANCES_IN_S_WHERE_REPLACED', $tableName)];
|
||||
}
|
||||
return ['not_found' => JText::sprintf('COM_COMPONENTBUILDER_NO_INSTANCES_WHERE_FOUND_IN_S', $tableName)];
|
||||
}
|
||||
catch(Exception $error)
|
||||
{
|
||||
return ['error' => $error->getMessage()];
|
||||
}
|
||||
}
|
||||
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
|
||||
}
|
||||
|
||||
return ['success' => JText::sprintf('COM_COMPONENTBUILDER_ALL_FOUND_INSTANCES_IN_S_WHERE_REPLACED', $tableName)];
|
||||
/**
|
||||
* Get a selected search value from a given table and row
|
||||
*
|
||||
* @param string $fieldName The field key
|
||||
* @param int $rowId The item ID
|
||||
* @param string $tableName The table
|
||||
* @param string $searchValue The value to search for
|
||||
* @param string|null $replaceValue The value to replace search value
|
||||
* @param int $matchCase The switch to control match case
|
||||
* @param int $wholeWord The switch to control whole word
|
||||
* @param int $regexSearch The switch to control regex search
|
||||
*
|
||||
* @return array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function getSearchValue(string $fieldName, int $rowId, string $tableName,
|
||||
string $searchValue, ?string $replaceValue = null, int $matchCase, int $wholeWord, int $regexSearch): array
|
||||
{
|
||||
// check if this is a valid table and field
|
||||
if ($rowId > 0 && SearchFactory::_('Table')->exist($tableName, $fieldName))
|
||||
{
|
||||
try
|
||||
{
|
||||
// load the configurations
|
||||
SearchFactory::_('Config')->table_name = $tableName;
|
||||
SearchFactory::_('Config')->type_search = 1;
|
||||
SearchFactory::_('Config')->search_value = $searchValue;
|
||||
SearchFactory::_('Config')->replace_value = $replaceValue;
|
||||
SearchFactory::_('Config')->match_case = $matchCase;
|
||||
SearchFactory::_('Config')->whole_word = $wholeWord;
|
||||
SearchFactory::_('Config')->regex_search = $regexSearch;
|
||||
|
||||
if (($value = SearchFactory::_('Agent')->getValue($rowId, $fieldName, 0, $tableName)) !== null)
|
||||
{
|
||||
// load the value
|
||||
return ['value' => $value];
|
||||
}
|
||||
}
|
||||
catch(Exception $error)
|
||||
{
|
||||
return ['error' => $error->getMessage()];
|
||||
}
|
||||
}
|
||||
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a replaced search value from a given table and row
|
||||
*
|
||||
* @param string $fieldName The field key
|
||||
* @param int $rowId The item ID
|
||||
* @param mixed $line The line line
|
||||
* @param string $tableName The table
|
||||
* @param string $searchValue The value to search for
|
||||
* @param string|null $replaceValue The value to replace search value
|
||||
* @param int $matchCase The switch to control match case
|
||||
* @param int $wholeWord The switch to control whole word
|
||||
* @param int $regexSearch The switch to control regex search
|
||||
*
|
||||
* @return array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function getReplaceValue(string $fieldName, int $rowId, $line, string $tableName,
|
||||
string $searchValue, ?string $replaceValue = null, int $matchCase, int $wholeWord, int $regexSearch): array
|
||||
{
|
||||
// check if this is a valid table and field
|
||||
if ($rowId > 0 && SearchFactory::_('Table')->exist($tableName, $fieldName))
|
||||
{
|
||||
try
|
||||
{
|
||||
// load the configurations
|
||||
SearchFactory::_('Config')->table_name = $tableName;
|
||||
SearchFactory::_('Config')->type_search = 2;
|
||||
SearchFactory::_('Config')->search_value = $searchValue;
|
||||
SearchFactory::_('Config')->replace_value = $replaceValue;
|
||||
SearchFactory::_('Config')->match_case = $matchCase;
|
||||
SearchFactory::_('Config')->whole_word = $wholeWord;
|
||||
SearchFactory::_('Config')->regex_search = $regexSearch;
|
||||
|
||||
// load the value
|
||||
if (($value = SearchFactory::_('Agent')->getValue($rowId, $fieldName, $line, $tableName, true)) !== null)
|
||||
{
|
||||
return ['value' => $value];
|
||||
}
|
||||
}
|
||||
catch(Exception $error)
|
||||
{
|
||||
return ['error' => $error->getMessage()];
|
||||
}
|
||||
}
|
||||
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set selected search value in a given table and row
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param int $rowId The item ID
|
||||
* @param string $fieldName The field key
|
||||
* @param string $tableName The table
|
||||
*
|
||||
* @return array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function setValue($value, int $rowId, string $fieldName, string $tableName): array
|
||||
{
|
||||
// check if this is a valid table and field
|
||||
if ($rowId > 0 && SearchFactory::_('Table')->exist($tableName, $fieldName) &&
|
||||
SearchFactory::_('Agent')->setValue($value, $rowId, $fieldName, $tableName))
|
||||
{
|
||||
return ['success' => JText::sprintf(
|
||||
'<b>%s</b> (%s:%s) was successfully updated!',
|
||||
$tableName, $rowId, $fieldName)];
|
||||
}
|
||||
return ['error' => JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')];
|
||||
}
|
||||
|
@ -139,69 +139,6 @@ class ComponentbuilderModelCompiler extends ListModel
|
||||
|
||||
public $compiler;
|
||||
|
||||
public function getComponents()
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
// Order it by the ordering field.
|
||||
$query->select($db->quoteName(array('id', 'system_name'),array('id', 'name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_component'));
|
||||
$query->where($db->quoteName('published') . ' = 1');
|
||||
$query->order('modified DESC');
|
||||
$query->order('created DESC');
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
// return the result
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
public function getCompilerAnimations(&$errorMessage)
|
||||
{
|
||||
// convert error message to array
|
||||
$errorMessage = array();
|
||||
$searchArray = array(
|
||||
// add banners (width - height)
|
||||
'banner' => array(
|
||||
'728-90',
|
||||
'160-600'
|
||||
),
|
||||
// The build-gif by size (width - height)
|
||||
'builder-gif' => array(
|
||||
'480-540'
|
||||
)
|
||||
);
|
||||
// start search, and get
|
||||
foreach ($searchArray as $type => $sizes)
|
||||
{
|
||||
// per size
|
||||
foreach ($sizes as $size)
|
||||
{
|
||||
// get size
|
||||
if (($set_size = ComponentbuilderHelper::getDynamicContentSize($type, $size)) !== 0)
|
||||
{
|
||||
// we loop over all type size artwork
|
||||
for ($target = 1; $target <= $set_size; $target++)
|
||||
{
|
||||
if (!ComponentbuilderHelper::getDynamicContent($type, $size, false, 0, $target))
|
||||
{
|
||||
$errorMessage[] = JText::sprintf('COM_COMPONENTBUILDER_S_S_NUMBER_BSB_COULD_NOT_BE_DOWNLOADED_SUCCESSFULLY_TO_THIS_JOOMLA_INSTALL', $type, $size, $target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if we had any errors
|
||||
if (ComponentbuilderHelper::checkArray($errorMessage))
|
||||
{
|
||||
// flatten the error message array
|
||||
$errorMessage = implode('<br />', $errorMessage);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function builder()
|
||||
{
|
||||
// run compiler
|
||||
@ -359,5 +296,91 @@ class ComponentbuilderModelCompiler extends ListModel
|
||||
$this->cleanCache('mod_menu', 1);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all components in the system
|
||||
*
|
||||
* @return array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function getComponents(): array
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = $this->getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select only id and system name
|
||||
$query->select($db->quoteName(array('id', 'system_name'),array('id', 'name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_component'));
|
||||
|
||||
// only the active components
|
||||
$query->where($db->quoteName('published') . ' = 1');
|
||||
|
||||
// Order it by the ordering field.
|
||||
$query->order('modified DESC');
|
||||
$query->order('created DESC');
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
|
||||
// return the result
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all dynamic content
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function getDynamicContent(&$errorMessage): bool
|
||||
{
|
||||
// convert error message to array
|
||||
$errorMessage = [];
|
||||
$searchArray = [
|
||||
// add banners (width - height)
|
||||
'banner' => [
|
||||
'728-90',
|
||||
'160-600'
|
||||
],
|
||||
// The build-gif by size (width - height)
|
||||
'builder-gif' => [
|
||||
'480-540'
|
||||
]
|
||||
];
|
||||
// start search, and get
|
||||
foreach ($searchArray as $type => $sizes)
|
||||
{
|
||||
// per size
|
||||
foreach ($sizes as $size)
|
||||
{
|
||||
// get size
|
||||
if (($set_size = ComponentbuilderHelper::getDynamicContentSize($type, $size)) !== 0)
|
||||
{
|
||||
// we loop over all type size artwork
|
||||
for ($target = 1; $target <= $set_size; $target++)
|
||||
{
|
||||
if (!ComponentbuilderHelper::getDynamicContent($type, $size, false, 0, $target))
|
||||
{
|
||||
$errorMessage[] = JText::sprintf('COM_COMPONENTBUILDER_S_S_NUMBER_BSB_COULD_NOT_BE_DOWNLOADED_SUCCESSFULLY_TO_THIS_JOOMLA_INSTALL', $type, $size, $target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if we had any errors
|
||||
if (ComponentbuilderHelper::checkArray($errorMessage))
|
||||
{
|
||||
// flatten the error message array
|
||||
$errorMessage = implode('<br />', $errorMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
@ -30,13 +29,15 @@ class ComponentbuilderModelComponentbuilder extends ListModel
|
||||
$icons = array();
|
||||
// view groups array
|
||||
$viewGroups = array(
|
||||
'main' => array('png.compiler', 'png.joomla_components', 'png.joomla_modules', 'png.joomla_plugins', 'png.powers', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=joomla_components&task=joomla_components.smartImport', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.placeholders', 'png.libraries', 'png.snippets', 'png.get_snippets', 'png.validation_rules', 'png.field.add', 'png.fields', 'png.fields.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_field', 'png.fieldtypes', 'png.fieldtypes.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_fieldtype', 'png.language_translations', 'png.servers', 'png.help_documents')
|
||||
'main' => array('png.compiler', 'png.joomla_components', 'png.joomla_modules', 'png.joomla_plugins', 'png.powers', 'png.search', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=joomla_components&task=joomla_components.smartImport', 'png.admin_views', 'png.custom_admin_views', 'png.site_views', 'png.template.add', 'png.templates', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.placeholders', 'png.libraries', 'png.snippets', 'png.get_snippets', 'png.validation_rules', 'png.field.add', 'png.fields', 'png.fields.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_field', 'png.fieldtypes', 'png.fieldtypes.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_fieldtype', 'png.language_translations', 'png.servers', 'png.help_documents')
|
||||
);
|
||||
// view access array
|
||||
$viewAccess = array(
|
||||
'compiler.submenu' => 'compiler.submenu',
|
||||
'compiler.dashboard_list' => 'compiler.dashboard_list',
|
||||
'search.access' => 'search.access',
|
||||
'search.submenu' => 'search.submenu',
|
||||
'search.dashboard_list' => 'search.dashboard_list',
|
||||
'get_snippets.submenu' => 'get_snippets.submenu',
|
||||
'get_snippets.dashboard_list' => 'get_snippets.dashboard_list',
|
||||
'joomla_component.create' => 'joomla_component.create',
|
||||
@ -64,17 +65,14 @@ class ComponentbuilderModelComponentbuilder extends ListModel
|
||||
'admin_view.access' => 'admin_view.access',
|
||||
'admin_views.submenu' => 'admin_view.submenu',
|
||||
'admin_views.dashboard_list' => 'admin_view.dashboard_list',
|
||||
'admin_view.dashboard_add' => 'admin_view.dashboard_add',
|
||||
'custom_admin_views.access' => 'custom_admin_view.access',
|
||||
'custom_admin_view.access' => 'custom_admin_view.access',
|
||||
'custom_admin_views.submenu' => 'custom_admin_view.submenu',
|
||||
'custom_admin_views.dashboard_list' => 'custom_admin_view.dashboard_list',
|
||||
'custom_admin_view.dashboard_add' => 'custom_admin_view.dashboard_add',
|
||||
'site_views.access' => 'site_view.access',
|
||||
'site_view.access' => 'site_view.access',
|
||||
'site_views.submenu' => 'site_view.submenu',
|
||||
'site_views.dashboard_list' => 'site_view.dashboard_list',
|
||||
'site_view.dashboard_add' => 'site_view.dashboard_add',
|
||||
'templates.access' => 'template.access',
|
||||
'template.access' => 'template.access',
|
||||
'templates.submenu' => 'template.submenu',
|
||||
|
@ -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) . ')');
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
100
admin/models/fields/superpowerpaths.php
Normal file
100
admin/models/fields/superpowerpaths.php
Normal 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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -153,6 +153,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_NAME_MESSAGE"
|
||||
|
@ -608,6 +608,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_MESSAGE"
|
||||
@ -1786,6 +1788,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CLASS_METHOD_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_CLASS_METHOD_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_MESSAGE"
|
||||
|
@ -137,6 +137,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NAME_MESSAGE"
|
||||
|
@ -138,6 +138,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NAME_MESSAGE"
|
||||
|
@ -116,6 +116,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_MESSAGE"
|
||||
@ -1118,6 +1120,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_DYNAMIC_GET_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_DYNAMIC_GET_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_FIELD_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_FIELD_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_FIELDTYPE_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_FIELDTYPE_NAME_MESSAGE"
|
||||
@ -322,6 +324,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_FIELDTYPE_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_FIELDTYPE_NAME_MESSAGE"
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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();"
|
||||
/>
|
||||
|
@ -1217,6 +1217,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_MESSAGE"
|
||||
|
@ -890,6 +890,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_MESSAGE"
|
||||
|
@ -857,6 +857,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_LANGUAGE_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_LANGUAGE_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_LAYOUT_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_LAYOUT_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_LIBRARY_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_LIBRARY_NAME_MESSAGE"
|
||||
|
@ -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,36 +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" />
|
||||
<!-- Main_class_code Field. Type: Editor. (joomla) -->
|
||||
<field
|
||||
type="editor"
|
||||
name="main_class_code"
|
||||
label="COM_COMPONENTBUILDER_POWER_MAIN_CLASS_CODE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_POWER_MAIN_CLASS_CODE_DESCRIPTION"
|
||||
width="100%"
|
||||
height="800px"
|
||||
cols="40"
|
||||
rows="300"
|
||||
buttons="no"
|
||||
syntax="php"
|
||||
editor="codemirror|none"
|
||||
filter="raw"
|
||||
validate="code"
|
||||
/>
|
||||
<!-- 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"
|
||||
@ -227,6 +231,104 @@
|
||||
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"
|
||||
name="composer"
|
||||
label="COM_COMPONENTBUILDER_POWER_COMPOSER_LABEL"
|
||||
layout="joomla.form.field.subform.repeatable-table"
|
||||
multiple="true"
|
||||
buttons="add,remove,move"
|
||||
icon="list"
|
||||
max="1"
|
||||
min="0">
|
||||
<form hidden="true" name="list_composer_modal" repeat="true">
|
||||
<!-- Access_point Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="access_point"
|
||||
label="COM_COMPONENTBUILDER_POWER_ACCESS_POINT_LABEL"
|
||||
size="70"
|
||||
maxlength="300"
|
||||
description="COM_COMPONENTBUILDER_POWER_ACCESS_POINT_DESCRIPTION"
|
||||
class="text_area"
|
||||
required="true"
|
||||
filter="PATH"
|
||||
message="COM_COMPONENTBUILDER_POWER_ACCESS_POINT_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_POWER_ACCESS_POINT_HINT"
|
||||
/>
|
||||
<!-- Namespace Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
name="namespace"
|
||||
label="COM_COMPONENTBUILDER_POWER_NAMESPACE_LABEL"
|
||||
layout="joomla.form.field.subform.repeatable-table"
|
||||
multiple="true"
|
||||
buttons="add,remove,move"
|
||||
icon="list"
|
||||
max="30"
|
||||
min="1"
|
||||
nested_depth="1">
|
||||
<form hidden="true" name="list_namespace_modal" repeat="true">
|
||||
<!-- Use Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="use"
|
||||
label="COM_COMPONENTBUILDER_POWER_USE_LABEL"
|
||||
size="70"
|
||||
maxlength="300"
|
||||
class="text_area"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_POWER_USE_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_POWER_USE_HINT"
|
||||
autocomplete="on"
|
||||
/>
|
||||
</form>
|
||||
</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"
|
||||
@ -267,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"
|
||||
@ -293,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) -->
|
||||
@ -372,20 +428,17 @@
|
||||
required="false"
|
||||
validate="code"
|
||||
/>
|
||||
<!-- Add_licensing_template Field. Type: Radio. (joomla) -->
|
||||
<!-- Approved_paths Field. Type: Superpowerpaths. (custom) -->
|
||||
<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">
|
||||
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="1">
|
||||
COM_COMPONENTBUILDER_POWER_USE_GLOBAL</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_POWER_OVERRIDE</option>
|
||||
<option value="joomla/super-powers">
|
||||
COM_COMPONENTBUILDER_POWER_JOOMLASUPERPOWERS</option>
|
||||
</field>
|
||||
<!-- Use_selection Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
@ -397,9 +450,8 @@
|
||||
buttons="add,remove,move"
|
||||
description="COM_COMPONENTBUILDER_POWER_USE_SELECTION_DESCRIPTION"
|
||||
icon="list"
|
||||
max="30"
|
||||
min="0"
|
||||
showon="type!:interface">
|
||||
max="100"
|
||||
min="0">
|
||||
<form hidden="true" name="list_use_selection_modal" repeat="true">
|
||||
<!-- Use Field. Type: Namespaces. (custom) -->
|
||||
<field
|
||||
@ -425,6 +477,41 @@
|
||||
/>
|
||||
</form>
|
||||
</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"
|
||||
name="main_class_code"
|
||||
label="COM_COMPONENTBUILDER_POWER_MAIN_CLASS_CODE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_POWER_MAIN_CLASS_CODE_DESCRIPTION"
|
||||
width="100%"
|
||||
height="800px"
|
||||
cols="40"
|
||||
rows="300"
|
||||
buttons="no"
|
||||
syntax="php"
|
||||
editor="codemirror|none"
|
||||
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"
|
||||
@ -448,6 +535,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_POWER_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_POWER_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_SERVER_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_SERVER_NAME_MESSAGE"
|
||||
|
@ -116,6 +116,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_SITE_VIEW_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_SITE_VIEW_NAME_MESSAGE"
|
||||
@ -1137,6 +1139,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_SITE_VIEW_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_SITE_VIEW_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_SNIPPET_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_SNIPPET_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_SNIPPET_TYPE_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_SNIPPET_TYPE_NAME_MESSAGE"
|
||||
|
@ -102,6 +102,8 @@
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_TEMPLATE_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_TEMPLATE_NAME_MESSAGE"
|
||||
|
@ -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
File diff suppressed because it is too large
Load Diff
@ -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) . ')');
|
||||
}
|
||||
|
@ -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
|
||||
@ -64,6 +67,21 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
'add_licensing_template',
|
||||
'licensing_template'
|
||||
)
|
||||
),
|
||||
'super_power' => array(
|
||||
'left' => array(
|
||||
'approved',
|
||||
'approved_paths'
|
||||
),
|
||||
'right' => array(
|
||||
'note_approved_paths'
|
||||
)
|
||||
),
|
||||
'composer' => array(
|
||||
'fullwidth' => array(
|
||||
'autoload_composer_note',
|
||||
'composer'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@ -178,12 +196,6 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->main_class_code))
|
||||
{
|
||||
// base64 Decode main_class_code.
|
||||
$item->main_class_code = base64_decode($item->main_class_code);
|
||||
}
|
||||
|
||||
if (!empty($item->licensing_template))
|
||||
{
|
||||
// base64 Decode licensing_template.
|
||||
@ -196,6 +208,20 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
$item->head = base64_decode($item->head);
|
||||
}
|
||||
|
||||
if (!empty($item->main_class_code))
|
||||
{
|
||||
// base64 Decode main_class_code.
|
||||
$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.
|
||||
@ -204,6 +230,14 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
$item->load_selection = $load_selection->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->composer))
|
||||
{
|
||||
// Convert the composer field to an array.
|
||||
$composer = new Registry;
|
||||
$composer->loadString($item->composer);
|
||||
$item->composer = $composer->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->property_selection))
|
||||
{
|
||||
// Convert the property_selection field to an array.
|
||||
@ -220,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.
|
||||
@ -236,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))
|
||||
{
|
||||
@ -989,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)
|
||||
@ -1037,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']))
|
||||
{
|
||||
@ -1050,6 +1101,19 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
$data['load_selection'] = '';
|
||||
}
|
||||
|
||||
// Set the composer items to data.
|
||||
if (isset($data['composer']) && is_array($data['composer']))
|
||||
{
|
||||
$composer = new JRegistry;
|
||||
$composer->loadArray($data['composer']);
|
||||
$data['composer'] = (string) $composer;
|
||||
}
|
||||
elseif (!isset($data['composer']))
|
||||
{
|
||||
// Set the empty composer to data
|
||||
$data['composer'] = '';
|
||||
}
|
||||
|
||||
// Set the property_selection items to data.
|
||||
if (isset($data['property_selection']) && is_array($data['property_selection']))
|
||||
{
|
||||
@ -1076,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']))
|
||||
{
|
||||
@ -1102,10 +1153,10 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
$data['use_selection'] = '';
|
||||
}
|
||||
|
||||
// Set the main_class_code string to base64 string.
|
||||
if (isset($data['main_class_code']))
|
||||
// Set the approved_paths string to JSON string.
|
||||
if (isset($data['approved_paths']))
|
||||
{
|
||||
$data['main_class_code'] = base64_encode($data['main_class_code']);
|
||||
$data['approved_paths'] = (string) json_encode($data['approved_paths']);
|
||||
}
|
||||
|
||||
// Set the licensing_template string to base64 string.
|
||||
@ -1119,6 +1170,12 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
{
|
||||
$data['head'] = base64_encode($data['head']);
|
||||
}
|
||||
|
||||
// Set the main_class_code string to base64 string.
|
||||
if (isset($data['main_class_code']))
|
||||
{
|
||||
$data['main_class_code'] = base64_encode($data['main_class_code']);
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
|
@ -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.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);
|
||||
}
|
||||
|
@ -114,8 +114,8 @@ class ComponentbuilderModelSearch extends ItemModel
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Get data
|
||||
// load the tables and components (soon)
|
||||
$data = ['tables' => SearchFactory::_('Table')->tables(), 'components' => null];
|
||||
// load the tables and components
|
||||
$data = ['tables' => SearchFactory::_('Table')->tables(), 'components' => $this->getComponents()];
|
||||
|
||||
|
||||
if (empty($data))
|
||||
@ -148,6 +148,51 @@ class ComponentbuilderModelSearch extends ItemModel
|
||||
return $this->_item[$pk];
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom Method
|
||||
*
|
||||
* @return mixed item data object on success, false on failure.
|
||||
*
|
||||
*/
|
||||
public function getUrlValues()
|
||||
{
|
||||
|
||||
if (!isset($this->initSet) || !$this->initSet)
|
||||
{
|
||||
$this->user = JFactory::getUser();
|
||||
$this->userId = $this->user->get('id');
|
||||
$this->guest = $this->user->get('guest');
|
||||
$this->groups = $this->user->get('groups');
|
||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||
$this->levels = $this->user->getAuthorisedViewLevels();
|
||||
$this->initSet = true;
|
||||
}
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Get data
|
||||
$data = [
|
||||
'type_search' => SearchFactory::_('Config')->get('type_search', 1),
|
||||
'search_value' => SearchFactory::_('Config')->get('search_value', ''),
|
||||
'replace_value' => SearchFactory::_('Config')->get('replace_value', ''),
|
||||
'match_case' => SearchFactory::_('Config')->get('match_case', 0),
|
||||
'whole_word' => SearchFactory::_('Config')->get('whole_word', 0),
|
||||
'regex_search' => SearchFactory::_('Config')->get('regex_search', 0),
|
||||
'table_name' => SearchFactory::_('Config')->get('table_name', -1)
|
||||
];
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// return data object.
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uikit needed components
|
||||
*
|
||||
@ -162,4 +207,38 @@ class ComponentbuilderModelSearch extends ItemModel
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all components in the system
|
||||
*
|
||||
* @return array
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function getComponents(): array
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = $this->getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select only id and system name
|
||||
$query->select($db->quoteName(array('id', 'system_name'),array('id', 'name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_component'));
|
||||
|
||||
// only the active components
|
||||
$query->where($db->quoteName('published') . ' = 1');
|
||||
|
||||
// Order it by the ordering field.
|
||||
$query->order('modified DESC');
|
||||
$query->order('created DESC');
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
|
||||
// return the result
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
1
admin/sql/updates/mysql/3.1.12.sql
Normal file
1
admin/sql/updates/mysql/3.1.12.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE `#__componentbuilder_power` ADD `composer` TEXT NOT NULL AFTER `add_licensing_template`;
|
1
admin/sql/updates/mysql/3.1.19.sql
Normal file
1
admin/sql/updates/mysql/3.1.19.sql
Normal file
@ -0,0 +1 @@
|
||||
|
2
admin/sql/updates/mysql/3.1.21.sql
Normal file
2
admin/sql/updates/mysql/3.1.21.sql
Normal 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`;
|
@ -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');
|
||||
@ -25,7 +26,6 @@ $selectNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_PLEASE_SELECT_A_COMPONEN
|
||||
$noticeboardOptions = array('vdm', 'pro');
|
||||
?>
|
||||
<?php if ($this->canDo->get('compiler.access')): ?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=compiler'); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
|
||||
<script type="text/javascript">
|
||||
Joomla.submitbutton = function(task, key)
|
||||
@ -35,7 +35,7 @@ Joomla.submitbutton = function(task, key)
|
||||
} else {
|
||||
var component = jQuery('#component_id').val();
|
||||
var isValid = true;
|
||||
|
||||
|
||||
if(component == '' && task == 'compiler.compiler'){
|
||||
isValid = false;
|
||||
}
|
||||
@ -126,74 +126,75 @@ jQuery('<div id="compiling"></div>')
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif; ?>
|
||||
<?php if (ComponentbuilderHelper::checkString($this->SuccessMessage)): ?>
|
||||
<div class="alert alert-success">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<?= $this->SuccessMessage; ?>
|
||||
</div>
|
||||
<?php if (StringHelper::check($this->SuccessMessage)): ?>
|
||||
<div class="alert alert-success">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<?php echo $this->SuccessMessage; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div id="form">
|
||||
<div class="span4">
|
||||
<h3><?= JText::_('COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT') ?></h3>
|
||||
<div id="compilerForm">
|
||||
<div>
|
||||
<span class="notice" style="display:none; color:red;"><?= 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"><?= $field->label ?></div>
|
||||
<div class="controls"><?= $field->input ?></div>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=compiler'); ?>"
|
||||
method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
<div id="form" >
|
||||
<div class="span4">
|
||||
<h3><?php echo JText::_('COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT'); ?></h3>
|
||||
<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 echo $this->form->renderFieldset('builder'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<br />
|
||||
<div class="clearfix"></div>
|
||||
<button class="btn btn-small btn-success" onclick="Joomla.submitbutton('compiler.compiler')"><span class="icon-cog icon-white"></span>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPILE_COMPONENT'); ?>
|
||||
</button>
|
||||
<input type="hidden" name="install_item_id" value="0">
|
||||
<input type="hidden" name="version" value="3" />
|
||||
</div>
|
||||
<br />
|
||||
<div class="clearfix"></div>
|
||||
<button class="btn btn-small btn-success" onclick="Joomla.submitbutton('compiler.compiler')"><span class="icon-cog icon-white"></span>
|
||||
<?= JText::_('COM_COMPONENTBUILDER_COMPILE_COMPONENT') ?>
|
||||
</button>
|
||||
<input type="hidden" name="install_item_id" value="0">
|
||||
<input type="hidden" name="version" value="3" />
|
||||
</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>
|
||||
</div>
|
||||
<div class="span7">
|
||||
<div id="component-details"><?= $selectNotice ?></div>
|
||||
<?= JLayoutHelper::render('jcbnoticeboardtabs', array('id' => 'noticeboard' , 'active' => $noticeboardOptions[array_rand($noticeboardOptions)])) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="get-compiler-animations" style="display:none;">
|
||||
<h1><?= JText::_('COM_COMPONENTBUILDER_PLEASE_WAIT') ?></h1>
|
||||
<h4><?= JText::_('COM_COMPONENTBUILDER_WHILE_WE_DOWNLOAD_ALL_TWENTY_SIX_COMPILER_GIF_ANIMATIONS_RANDOMLY_USED_IN_THE_COMPILER_GUI_DURING_COMPILATION') ?> <span class="loading-dots">.</span></h4>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div id="clear" style="display:none;">
|
||||
<h1><?= JText::_('COM_COMPONENTBUILDER_PLEASE_WAIT') ?></h1>
|
||||
<h4><?= JText::_('COM_COMPONENTBUILDER_REMOVING_ALL_ZIP_PACKAGES_FROM_THE_TEMPORARY_FOLDER_OF_THE_JOOMLA_INSTALL') ?> <span class="loading-dots">.</span></h4>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div id="compiler" style="display:none;">
|
||||
<div id="compiler-spinner" class="span4" style="display:none;">
|
||||
<h3><?= JText::sprintf('COM_COMPONENTBUILDER_S_PLEASE_WAIT', $this->user->name) ?></h3>
|
||||
<p style="font-size: smaller;"><?= JText::_('COM_COMPONENTBUILDER_THIS_MAY_TAKE_A_WHILE_DEPENDING_ON_THE_SIZE_OF_YOUR_PROJECT') ?></p>
|
||||
<p><b><span class="component-name"><?= JText::_('COM_COMPONENTBUILDER_THE_COMPONENT') ?></span></b> <?= JText::_('COM_COMPONENTBUILDER_IS_BEING_COMPILED') ?> <span class="loading-dots">.</span></p>
|
||||
<div style="text-align: center;"><?= ComponentbuilderHelper::getDynamicContent('builder-gif', $this->builder_gif_size) ?></div>
|
||||
<div id="get-compiler-animations" style="display:none;">
|
||||
<h1><?php echo JText::_('COM_COMPONENTBUILDER_PLEASE_WAIT'); ?></h1>
|
||||
<h4><?php echo JText::_('COM_COMPONENTBUILDER_WHILE_WE_DOWNLOAD_ALL_TWENTY_SIX_COMPILER_GIF_ANIMATIONS_RANDOMLY_USED_IN_THE_COMPILER_GUI_DURING_COMPILATION'); ?> <span class="loading-dots">.</span></h4>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div id="compiler-notice" class="span7" style="display:none;">
|
||||
<?= JLayoutHelper::render('jcbnoticeboard' . $noticeboardOptions[array_rand($noticeboardOptions)], null) ?>
|
||||
<div><?= ComponentbuilderHelper::getDynamicContent('banner', '728-90') ?></div>
|
||||
<div id="clear" style="display:none;">
|
||||
<h1><?php echo JText::_('COM_COMPONENTBUILDER_PLEASE_WAIT'); ?></h1>
|
||||
<h4><?php echo JText::_('COM_COMPONENTBUILDER_REMOVING_ALL_ZIP_PACKAGES_FROM_THE_TEMPORARY_FOLDER_OF_THE_JOOMLA_INSTALL'); ?> <span class="loading-dots">.</span></h4>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="compiler" style="display:none;">
|
||||
<div id="compiler-spinner" class="span4" style="display:none;">
|
||||
<h3><?php echo JText::sprintf('COM_COMPONENTBUILDER_S_PLEASE_WAIT', $this->user->name); ?></h3>
|
||||
<p style="font-size: smaller;"><?php echo JText::_('COM_COMPONENTBUILDER_THIS_MAY_TAKE_A_WHILE_DEPENDING_ON_THE_SIZE_OF_YOUR_PROJECT'); ?></p>
|
||||
<p><b><span class="component-name"><?php echo JText::_('COM_COMPONENTBUILDER_THE_COMPONENT'); ?></span></b> <?php echo JText::_('COM_COMPONENTBUILDER_IS_BEING_COMPILED'); ?> <span class="loading-dots">.</span></p>
|
||||
<div style="text-align: center;"><?php echo ComponentbuilderHelper::getDynamicContent('builder-gif', $this->builder_gif_size); ?></div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div id="compiler-notice" class="span7" style="display:none;">
|
||||
<?php echo JLayoutHelper::render('jcbnoticeboard' . $noticeboardOptions[array_rand($noticeboardOptions)], null); ?>
|
||||
<div><?php echo ComponentbuilderHelper::getDynamicContent('banner', '728-90'); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
// token
|
||||
var token = '<?= JSession::getFormToken() ?>';
|
||||
var all_is_good = '<?= JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME') ?>';
|
||||
var token = '<?php echo JSession::getFormToken(); ?>';
|
||||
var all_is_good = '<?php echo JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME'); ?>';
|
||||
jQuery('#compilerForm').on('change', '#component_id',function (e)
|
||||
{
|
||||
var component = jQuery('#component_id').val();
|
||||
if(component == "") {
|
||||
jQuery('#component-details').html("<?= $selectNotice ?>");
|
||||
jQuery('#component-details').html("<?php echo $selectNotice; ?>");
|
||||
jQuery("#noticeboard").show();
|
||||
jQuery('.notice').show();
|
||||
} else {
|
||||
@ -233,9 +234,6 @@ function JRouter(link) {
|
||||
return url+link;
|
||||
}
|
||||
</script>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<h1><?php echo JText::_('COM_COMPONENTBUILDER_NO_ACCESS_GRANTED'); ?></h1>
|
||||
<?php endif; ?>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user